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 @@ -76,6 +76,7 @@
import { waitForSearchIndexed } from '../../utils/polling';
import { sidebarClick } from '../../utils/sidebar';
import { test } from '../fixtures/pages';
import { navigateToKCEntity } from '../Utils/ExplorePageRightPanelUtils';
import {
runAdvancedBlocksTest,
runContentPersistenceTest,
Expand Down Expand Up @@ -395,6 +396,57 @@
});
});

test('Article tags added on the article page are visible in the Explore right-panel summary', async ({
page,
browser,
}) => {
const { apiContext: setupContext, afterAction: setupAfterAction } =
await createNewPage(browser);
const article = await createArticleViaApi(setupContext, {
displayName: `CC Tag Panel Article ${uuid()}`,
name: `cc_tag_panel_article_${uuid()}`,
});
await setupAfterAction();

const tagDisplayName = 'Article';
const tagFqn = 'KnowledgeCenter.Article';

try {
await test.step('Add tag to article via the article page', async () => {
await navigateToArticle(page, article.fullyQualifiedName);
await updateTags(page, { tag: tagDisplayName, tagFqn });
});

await test.step('Wait for search index to reflect the update', async () => {
const { apiContext, afterAction } = await getApiContext(page);
await waitForSearchIndexed(
apiContext,
article.fullyQualifiedName,
'page'
);
await afterAction();
});

await test.step('Verify tag is visible in Explore right-panel summary', async () => {
await navigateToKCEntity(page, article.displayName);

const summaryPanel = page.locator(
'[data-testid="entity-summary-panel-container"]'
);
await expect(
summaryPanel
.locator('.tags-section, [class*="tags"]')
.getByText(tagDisplayName)
).toBeVisible();
});
} finally {
const { apiContext: cleanupContext, afterAction: cleanupAfterAction } =
await createNewPage(browser);
await deleteArticleByFqn(cleanupContext, article.fullyQualifiedName);
await cleanupAfterAction();
}
});

test('Quick link lifecycle validates, creates, edits, and deletes from card', async ({
page,
}) => {
Expand Down Expand Up @@ -636,7 +688,7 @@
url.pathname.includes('/context-center/articles/')
);
await waitForAllLoadersToDisappear(page);
await page.waitForTimeout(500);

Check warning on line 691 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 @@ -1201,7 +1253,7 @@
.click();
await page.getByTestId('save').click();

await page.waitForSelector(

Check warning on line 1256 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 @@ -1456,7 +1508,7 @@
.getByTestId('entity-header-display-name')
.fill(newDisplayName);
await page.getByText('Unsaved').waitFor({ state: 'visible' });
await page.waitForTimeout(400);

Check warning on line 1511 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
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ import * as apiCollectionsAPI from '../rest/apiCollectionsAPI';
import * as apiEndpointsAPI from '../rest/apiEndpointsAPI';
import * as databaseAPI from '../rest/databaseAPI';
import * as glossaryAPI from '../rest/glossaryAPI';
import * as knowledgeCenterAPI from '../rest/knowledgeCenterAPI';
import * as serviceAPI from '../rest/serviceAPI';
import * as tableAPI from '../rest/tableAPI';
import * as testAPI from '../rest/testAPI';
Expand All @@ -26,6 +27,7 @@ import { getEntityByFqnUtil } from './EntityByFqnUtils';
jest.mock('../rest/tableAPI');
jest.mock('../rest/databaseAPI');
jest.mock('../rest/glossaryAPI');
jest.mock('../rest/knowledgeCenterAPI');
jest.mock('../rest/serviceAPI');
jest.mock('../rest/alertsAPI');
jest.mock('../rest/apiCollectionsAPI');
Expand Down Expand Up @@ -235,6 +237,48 @@ describe('EntityByFqnUtils', () => {
expect(result).toEqual(mockEventSubData);
});

it('should fetch KNOWLEDGE_PAGE entity forwarding the requested fields', async () => {
const mockPageData = { id: '1', name: 'test-article' };
(knowledgeCenterAPI.getKnowledgePageByFqn as jest.Mock).mockResolvedValue(
mockPageData
);

const result = await getEntityByFqnUtil(
EntityType.KNOWLEDGE_PAGE,
mockFqn,
mockFields
);

expect(knowledgeCenterAPI.getKnowledgePageByFqn).toHaveBeenCalledWith(
mockFqn,
{
fields: mockFields,
}
);
expect(result).toEqual(mockPageData);
});

it('should fetch KNOWLEDGE_CENTER entity forwarding the requested fields', async () => {
const mockPageData = { id: '1', name: 'test-article' };
(knowledgeCenterAPI.getKnowledgePageByFqn as jest.Mock).mockResolvedValue(
mockPageData
);

const result = await getEntityByFqnUtil(
EntityType.KNOWLEDGE_CENTER,
mockFqn,
mockFields
);

expect(knowledgeCenterAPI.getKnowledgePageByFqn).toHaveBeenCalledWith(
mockFqn,
{
fields: mockFields,
}
);
expect(result).toEqual(mockPageData);
});

it('should return null for unknown entity type', async () => {
const result = await getEntityByFqnUtil('UNKNOWN_TYPE', mockFqn);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@
entityType: string,
entityFQN: string,
fields?: string
): Promise<EntityUnion> | null => {

Check warning on line 60 in openmetadata-ui/src/main/resources/ui/src/utils/EntityByFqnUtils.ts

View workflow job for this annotation

GitHub Actions / checkstyle

{"message":"Function has a complexity of 51 which is greater than 10 authorized.","cost":41,"secondaryLocations":[{"line":60,"column":31,"endLine":60,"endColumn":33,"message":"+1"},{"line":62,"column":4,"endLine":62,"endColumn":8,"message":"+1"},{"line":65,"column":4,"endLine":65,"endColumn":8,"message":"+1"},{"line":70,"column":4,"endLine":70,"endColumn":8,"message":"+1"},{"line":73,"column":4,"endLine":73,"endColumn":8,"message":"+1"},{"line":76,"column":4,"endLine":76,"endColumn":8,"message":"+1"},{"line":79,"column":4,"endLine":79,"endColumn":8,"message":"+1"},{"line":82,"column":4,"endLine":82,"endColumn":8,"message":"+1"},{"line":85,"column":4,"endLine":85,"endColumn":8,"message":"+1"},{"line":90,"column":4,"endLine":90,"endColumn":8,"message":"+1"},{"line":96,"column":4,"endLine":96,"endColumn":8,"message":"+1"},{"line":101,"column":4,"endLine":101,"endColumn":8,"message":"+1"},{"line":106,"column":4,"endLine":106,"endColumn":8,"message":"+1"},{"line":112,"column":4,"endLine":112,"endColumn":8,"message":"+1"},{"line":115,"column":4,"endLine":115,"endColumn":8,"message":"+1"},{"line":118,"column":4,"endLine":118,"endColumn":8,"message":"+1"},{"line":123,"column":4,"endLine":123,"endColumn":8,"message":"+1"},{"line":128,"column":4,"endLine":128,"endColumn":8,"message":"+1"},{"line":131,"column":4,"endLine":131,"endColumn":8,"message":"+1"},{"line":134,"column":4,"endLine":134,"endColumn":8,"message":"+1"},{"line":137,"column":4,"endLine":137,"endColumn":8,"message":"+1"},{"line":146,"column":4,"endLine":146,"endColumn":8,"message":"+1"},{"line":151,"column":4,"endLine":151,"endColumn":8,"message":"+1"},{"line":154,"column":4,"endLine":154,"endColumn":8,"message":"+1"},{"line":157,"column":4,"endLine":157,"endColumn":8,"message":"+1"},{"line":160,"column":4,"endLine":160,"endColumn":8,"message":"+1"},{"line":163,"column":4,"endLine":163,"endColumn":8,"message":"+1"},{"line":164,"column":4,"endLine":164,"endColumn":8,"message":"+1"},{"line":165,"column":4,"endLine":165,"endColumn":8,"message":"+1"},{"line":166,"column":4,"endLine":166,"endColumn":8,"message":"+1"},{"line":167,"column":4,"endLine":167,"endColumn":8,"message":"+1"},{"line":168,"column":4,"endLine":168,"endColumn":8,"message":"+1"},{"line":169,"column":4,"endLine":169,"endColumn":8,"message":"+1"},{"line":170,"column":4,"endLine":170,"endColumn":8,"message":"+1"},{"line":171,"column":4,"endLine":171,"endColumn":8,"message":"+1"},{"line":172,"column":4,"endLine":172,"endColumn":8,"message":"+1"},{"line":175,"column":4,"endLine":175,"endColumn":8,"message":"+1"},{"line":178,"column":4,"endLine":178,"endColumn":8,"message":"+1"},{"line":181,"column":4,"endLine":181,"endColumn":8,"message":"+1"},{"line":184,"column":4,"endLine":184,"endColumn":8,"message":"+1"},{"line":187,"column":4,"endLine":187,"endColumn":8,"message":"+1"},{"line":190,"column":4,"endLine":190,"endColumn":8,"message":"+1"},{"line":193,"column":4,"endLine":193,"endColumn":8,"message":"+1"},{"line":196,"column":4,"endLine":196,"endColumn":8,"message":"+1"},{"line":199,"column":4,"endLine":199,"endColumn":8,"message":"+1"},{"line":202,"column":4,"endLine":202,"endColumn":8,"message":"+1"},{"line":205,"column":4,"endLine":205,"endColumn":8,"message":"+1"},{"line":208,"column":4,"endLine":208,"endColumn":8,"message":"+1"},{"line":211,"column":4,"endLine":211,"endColumn":8,"message":"+1"},{"line":214,"column":4,"endLine":214,"endColumn":8,"message":"+1"},{"line":215,"column":4,"endLine":215,"endColumn":8,"message":"+1"}]}
switch (entityType) {
case EntityType.TABLE:
return getTableDetailsByFQN(entityFQN, { fields });
Expand Down Expand Up @@ -213,7 +213,7 @@

case EntityType.KNOWLEDGE_PAGE:
case EntityType.KNOWLEDGE_CENTER:
return getKnowledgePageByFqn(entityFQN);
return getKnowledgePageByFqn(entityFQN, { fields });

default:
return null;
Expand Down
Loading