mirror of
https://github.com/open-metadata/OpenMetadata.git
synced 2025-09-29 19:05:16 +00:00
chore(ui): fix glossary tests (#23368)
This commit is contained in:
parent
2e134b2cfe
commit
5a68dba5f0
@ -73,7 +73,6 @@ import {
|
||||
verifyAllColumns,
|
||||
verifyColumnsVisibility,
|
||||
verifyGlossaryDetails,
|
||||
verifyGlossaryTermAssets,
|
||||
verifyGlossaryWorkflowReviewerCase,
|
||||
verifyTaskCreated,
|
||||
verifyWorkflowInstanceExists,
|
||||
@ -744,12 +743,18 @@ test.describe('Glossary tests', () => {
|
||||
await goToAssetsTab(page, glossaryTerm1.data.displayName);
|
||||
await addAssetToGlossaryTerm(page, assets);
|
||||
await renameGlossaryTerm(page, glossaryTerm1, newName);
|
||||
await verifyGlossaryTermAssets(
|
||||
page,
|
||||
glossary1.data,
|
||||
glossaryTerm1.data,
|
||||
assets.length
|
||||
|
||||
await page.click('[data-testid="overview"]');
|
||||
const queryRes = page.waitForResponse(
|
||||
'/api/v1/search/query?q=*&index=all&from=0&size=15'
|
||||
);
|
||||
await page.getByTestId('assets').click();
|
||||
await queryRes;
|
||||
await page.waitForSelector('.ant-tabs-tab-active:has-text("Assets")');
|
||||
|
||||
await expect(
|
||||
page.getByTestId('assets').getByTestId('filter-count')
|
||||
).toContainText(`${assets.length}`);
|
||||
});
|
||||
|
||||
await test.step('Rename the same entity again', async () => {
|
||||
@ -763,12 +768,17 @@ test.describe('Glossary tests', () => {
|
||||
assets.length
|
||||
);
|
||||
await renameGlossaryTerm(page, glossaryTerm1, newName);
|
||||
await verifyGlossaryTermAssets(
|
||||
page,
|
||||
glossary1.data,
|
||||
glossaryTerm1.data,
|
||||
assets.length
|
||||
await page.click('[data-testid="overview"]');
|
||||
const queryRes = page.waitForResponse(
|
||||
'/api/v1/search/query?q=*&index=all&from=0&size=15'
|
||||
);
|
||||
await page.getByTestId('assets').click();
|
||||
await queryRes;
|
||||
await page.waitForSelector('.ant-tabs-tab-active:has-text("Assets")');
|
||||
|
||||
await expect(
|
||||
page.getByTestId('assets').getByTestId('filter-count')
|
||||
).toContainText(`${assets.length}`);
|
||||
});
|
||||
} finally {
|
||||
await table.delete(apiContext);
|
||||
@ -1018,8 +1028,13 @@ test.describe('Glossary tests', () => {
|
||||
).not.toBeVisible();
|
||||
|
||||
await selectActiveGlossary(page, glossary2.data.displayName);
|
||||
|
||||
const termRes = page.waitForResponse(
|
||||
'/api/v1/glossaryTerms?directChildrenOf=*&fields=childrenCount%2Cowners%2Creviewers&limit=1000'
|
||||
);
|
||||
// verify the term is moved to the destination glossary
|
||||
await page.getByTestId('expand-collapse-all-button').click();
|
||||
await termRes;
|
||||
|
||||
await expect(
|
||||
page.getByRole('cell', {
|
||||
@ -1228,7 +1243,12 @@ test.describe('Glossary tests', () => {
|
||||
await selectActiveGlossary(page, glossary1.data.displayName);
|
||||
await selectActiveGlossaryTerm(page, glossaryTerm1.data.displayName);
|
||||
await page.getByTestId('terms').click();
|
||||
|
||||
const termRes = page.waitForResponse(
|
||||
'/api/v1/glossaryTerms?directChildrenOf=*&fields=childrenCount%2Cowners%2Creviewers&limit=1000'
|
||||
);
|
||||
await page.getByTestId('expand-collapse-all-button').click();
|
||||
await termRes;
|
||||
|
||||
await expect(
|
||||
page.getByRole('cell', { name: glossaryTerm2.data.displayName })
|
||||
@ -1419,7 +1439,12 @@ test.describe('Glossary tests', () => {
|
||||
try {
|
||||
await sidebarClick(page, SidebarItem.GLOSSARY);
|
||||
await selectActiveGlossary(page, glossary1.data.displayName);
|
||||
|
||||
const termRes = page.waitForResponse(
|
||||
'/api/v1/glossaryTerms?directChildrenOf=*&fields=childrenCount%2Cowners%2Creviewers&limit=1000'
|
||||
);
|
||||
await page.getByTestId('expand-collapse-all-button').click();
|
||||
await termRes;
|
||||
|
||||
await expect(
|
||||
page.getByRole('cell', { name: glossaryTerm1.data.displayName })
|
||||
|
@ -117,12 +117,33 @@ export const validateDomainForm = async (page: Page) => {
|
||||
await expect(page.locator('#name_help')).toHaveText(NAME_VALIDATION_ERROR);
|
||||
};
|
||||
|
||||
export const selectDomain = async (page: Page, domain: Domain['data']) => {
|
||||
await page
|
||||
.getByRole('menuitem', { name: domain.displayName })
|
||||
.locator('span')
|
||||
.click();
|
||||
export const selectDomain = async (
|
||||
page: Page,
|
||||
domain: Domain['data'],
|
||||
bWaitForResponse = true
|
||||
) => {
|
||||
const menuItem = page.getByRole('menuitem', { name: domain.displayName });
|
||||
const isSelected = await menuItem.evaluate((element) => {
|
||||
return element.classList.contains('ant-menu-item-selected');
|
||||
});
|
||||
|
||||
if (!isSelected) {
|
||||
if (bWaitForResponse) {
|
||||
const domainRes = page.waitForResponse(
|
||||
'/api/v1/domains/name/*?fields=children%2Cowners%2Cparent%2Cexperts%2Ctags%2Cfollowers%2Cextension'
|
||||
);
|
||||
await menuItem.click();
|
||||
await domainRes;
|
||||
} else {
|
||||
await menuItem.click();
|
||||
}
|
||||
}
|
||||
|
||||
await page.waitForLoadState('networkidle');
|
||||
|
||||
await page.waitForSelector('[data-testid="loader"]', {
|
||||
state: 'detached',
|
||||
});
|
||||
};
|
||||
|
||||
export const selectSubDomain = async (
|
||||
@ -244,8 +265,6 @@ export const checkDomainDisplayName = async (
|
||||
page: Page,
|
||||
displayName: string
|
||||
) => {
|
||||
await page.waitForLoadState('networkidle');
|
||||
|
||||
await expect(page.getByTestId('entity-header-display-name')).toHaveText(
|
||||
displayName
|
||||
);
|
||||
|
@ -841,19 +841,6 @@ export const updateNameForGlossaryTerm = async (
|
||||
return data;
|
||||
};
|
||||
|
||||
export const verifyGlossaryTermAssets = async (
|
||||
page: Page,
|
||||
glossary: GlossaryData,
|
||||
glossaryTermData: GlossaryTermData,
|
||||
assetsLength: number
|
||||
) => {
|
||||
await page.click('[data-testid="overview"]');
|
||||
await redirectToHomePage(page);
|
||||
await sidebarClick(page, SidebarItem.GLOSSARY);
|
||||
await selectActiveGlossary(page, glossary.displayName);
|
||||
await goToAssetsTab(page, glossaryTermData.displayName, assetsLength);
|
||||
};
|
||||
|
||||
export const renameGlossaryTerm = async (
|
||||
page: Page,
|
||||
glossaryTerm: GlossaryTerm,
|
||||
|
Loading…
x
Reference in New Issue
Block a user