From 25b0fb39e920649dce141b3a01e56faddffe93f6 Mon Sep 17 00:00:00 2001 From: Karan Hotchandani <33024356+karanh37@users.noreply.github.com> Date: Tue, 14 Jan 2025 21:44:40 +0530 Subject: [PATCH] fix glossary tests (#19352) (cherry picked from commit 94cbadb772a0f118fcc0621b2ad94d7e8e295709) --- .../resources/ui/playwright/e2e/Pages/Glossary.spec.ts | 8 ++++++-- .../src/main/resources/ui/playwright/utils/glossary.ts | 5 ++++- 2 files changed, 10 insertions(+), 3 deletions(-) diff --git a/openmetadata-ui/src/main/resources/ui/playwright/e2e/Pages/Glossary.spec.ts b/openmetadata-ui/src/main/resources/ui/playwright/e2e/Pages/Glossary.spec.ts index 2e4e0da8ce1f..eb734d2a8156 100644 --- a/openmetadata-ui/src/main/resources/ui/playwright/e2e/Pages/Glossary.spec.ts +++ b/openmetadata-ui/src/main/resources/ui/playwright/e2e/Pages/Glossary.spec.ts @@ -1216,13 +1216,17 @@ test.describe('Glossary tests', () => { const firstGlossaryName = json.data[0].displayName; await expect( - page.getByRole('menuitem', { name: firstGlossaryName }) + page + .getByTestId('glossary-left-panel') + .getByRole('menuitem', { name: firstGlossaryName }) ).toBeVisible(); const lastGlossaryName = json.data[json.data.length - 1].displayName; await expect( - page.getByRole('menuitem', { name: lastGlossaryName }) + page + .getByTestId('glossary-left-panel') + .getByRole('menuitem', { name: lastGlossaryName }) ).toBeVisible(); } finally { for (const glossary of glossaries) { diff --git a/openmetadata-ui/src/main/resources/ui/playwright/utils/glossary.ts b/openmetadata-ui/src/main/resources/ui/playwright/utils/glossary.ts index 4ee37ae5ca0c..339fadbd240f 100644 --- a/openmetadata-ui/src/main/resources/ui/playwright/utils/glossary.ts +++ b/openmetadata-ui/src/main/resources/ui/playwright/utils/glossary.ts @@ -62,11 +62,14 @@ export const selectActiveGlossary = async ( const isSelected = await menuItem.evaluate((element) => { return element.classList.contains('ant-menu-item-selected'); }); - if (!isSelected) { const glossaryResponse = page.waitForResponse('/api/v1/glossaryTerms*'); await menuItem.click(); await glossaryResponse; + } else { + await page.waitForSelector('[data-testid="loader"]', { + state: 'detached', + }); } };