Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -636,7 +636,7 @@
url.pathname.includes('/context-center/articles/')
);
await waitForAllLoadersToDisappear(page);
await page.waitForTimeout(500);

Check warning on line 639 in openmetadata-ui/src/main/resources/ui/playwright/e2e/Features/ContextCenterArticles.spec.ts

View workflow job for this annotation

GitHub Actions / checkstyle

Unexpected use of page.waitForTimeout()

await navigateToArticles(page);
const rightPanel = page.getByTestId('knowledge-center-right-panel');
Expand Down Expand Up @@ -735,6 +735,7 @@
).not.toBeVisible();

await page.getByLabel('Expand All').click();
await expect(page.getByLabel('Collapse All')).toBeVisible();
await expect(
page.getByTestId(`page-node-${child.displayName}`)
).toBeVisible();
Expand All @@ -752,6 +753,98 @@
await cleanupAfterAction();
});

test('Expanding a multi-level hierarchy does not throw and renders no duplicate nodes', async ({
page,
}) => {
test.slow();
const { apiContext, afterAction } = await getApiContext(page);

const grandparent = await createArticleViaApi(apiContext, {
displayName: `CC Deep Grandparent ${uuid()}`,
name: `cc_deep_grandparent_${uuid()}`,
});
const parent = await createArticleViaApi(apiContext, {
displayName: `CC Deep Parent ${uuid()}`,
name: `cc_deep_parent_${uuid()}`,
});
const child = await createArticleViaApi(apiContext, {
displayName: `CC Deep Child ${uuid()}`,
name: `cc_deep_child_${uuid()}`,
});

const patchParent = async (
pageId: string,
parentEntity: KnowledgeCenterResponseDataType
) => {
await apiContext.patch(`/api/v1/contextCenter/pages/${pageId}`, {
data: [
{
op: 'add',
path: '/parent',
value: {
id: parentEntity.id,
type: 'page',
fullyQualifiedName: parentEntity.fullyQualifiedName,
displayName: parentEntity.displayName,
name: parentEntity.name,
},
},
],
headers: { 'Content-Type': 'application/json-patch+json' },
});
};

await patchParent(parent.id, grandparent);
await patchParent(child.id, parent);
await afterAction();

const pageErrors: string[] = [];
page.on('pageerror', (error) =>
pageErrors.push(error.stack ?? error.message)
);

await navigateToArticles(page);
await scrollHierarchyToNode(page, grandparent.displayName);

await page
.getByRole('button', {
name: `Expand ${grandparent.displayName}`,
})
.click();
await expect(
page.getByTestId(`page-node-${parent.displayName}`)
).toBeVisible();

await page
.getByRole('button', {
name: `Expand ${parent.displayName}`,
})
.click();
await expect(
page.getByTestId(`page-node-${child.displayName}`)
).toBeVisible();

await page.getByLabel('Expand All').click();
await expect(page.getByLabel('Collapse All')).toBeVisible();
await page.getByLabel('Collapse All').click();
await expect(page.getByLabel('Expand All')).toBeVisible();
await page.getByLabel('Expand All').click();
await expect(page.getByLabel('Collapse All')).toBeVisible();
await expect(
page.getByTestId(`page-node-${child.displayName}`)
).toBeVisible();

for (const displayName of [
grandparent.displayName,
parent.displayName,
child.displayName,
]) {
await expect(page.getByTestId(`page-node-${displayName}`)).toHaveCount(1);
}

expect(pageErrors).toEqual([]);
});

test('Article detail layout, drawer, activity tab, and version page work', async ({
page,
browser,
Expand Down Expand Up @@ -1097,7 +1190,7 @@
.click();
await page.getByTestId('save').click();

await page.waitForSelector(

Check warning on line 1193 in openmetadata-ui/src/main/resources/ui/playwright/e2e/Features/ContextCenterArticles.spec.ts

View workflow job for this annotation

GitHub Actions / checkstyle

Unexpected use of page.waitForSelector()
'[role="dialog"].description-markdown-editor',
{ state: 'hidden' }
);
Expand Down Expand Up @@ -1344,7 +1437,7 @@
.getByTestId('entity-header-display-name')
.fill(newDisplayName);
await page.getByText('Unsaved').waitFor({ state: 'visible' });
await page.waitForTimeout(400);

Check warning on line 1440 in openmetadata-ui/src/main/resources/ui/playwright/e2e/Features/ContextCenterArticles.spec.ts

View workflow job for this annotation

GitHub Actions / checkstyle

Unexpected use of page.waitForTimeout()
await page.getByRole('link', { name: 'Articles' }).click();
});

Expand Down Expand Up @@ -1401,7 +1494,7 @@
await navigateToArticle(page, draftArticleA.fullyQualifiedName);
await page.fill('.om-block-editor', reloadDescription);
await page.getByText('Unsaved').waitFor({ state: 'visible' });
await page.waitForTimeout(400);

Check warning on line 1497 in openmetadata-ui/src/main/resources/ui/playwright/e2e/Features/ContextCenterArticles.spec.ts

View workflow job for this annotation

GitHub Actions / checkstyle

Unexpected use of page.waitForTimeout()
});

await test.step('Reload the page (simulates browser refresh before auto-save)', async () => {
Expand Down Expand Up @@ -1480,7 +1573,7 @@
await navigateToArticle(page, articleToDelete.fullyQualifiedName);
await page.fill('.om-block-editor', 'This draft should be deleted');
await page.getByText('Unsaved').waitFor({ state: 'visible' });
await page.waitForTimeout(400);

Check warning on line 1576 in openmetadata-ui/src/main/resources/ui/playwright/e2e/Features/ContextCenterArticles.spec.ts

View workflow job for this annotation

GitHub Actions / checkstyle

Unexpected use of page.waitForTimeout()
});

await test.step('Navigate away to ensure draft is persisted in localStorage', async () => {
Expand Down Expand Up @@ -1528,14 +1621,14 @@
await navigateToArticle(page, draftArticleA.fullyQualifiedName);
await page.fill('.om-block-editor', contentA);
await page.getByText('Unsaved').waitFor({ state: 'visible' });
await page.waitForTimeout(400);

Check warning on line 1624 in openmetadata-ui/src/main/resources/ui/playwright/e2e/Features/ContextCenterArticles.spec.ts

View workflow job for this annotation

GitHub Actions / checkstyle

Unexpected use of page.waitForTimeout()
});

await test.step('Navigate to draft article B and type without saving', async () => {
await navigateToArticle(page, draftArticleB.fullyQualifiedName);
await page.fill('.om-block-editor', contentB);
await page.getByText('Unsaved').waitFor({ state: 'visible' });
await page.waitForTimeout(400);

Check warning on line 1631 in openmetadata-ui/src/main/resources/ui/playwright/e2e/Features/ContextCenterArticles.spec.ts

View workflow job for this annotation

GitHub Actions / checkstyle

Unexpected use of page.waitForTimeout()
});

await test.step('Reload Article B — its own draft should be synced', async () => {
Expand Down

This file was deleted.

This file was deleted.

Loading
Loading