From db5258f35982c33a0a9ef70c0e1d02c070fc049a Mon Sep 17 00:00:00 2001 From: Ashish Gupta Date: Thu, 7 Aug 2025 10:53:24 +0530 Subject: [PATCH] PLAYWRIGHT: Unskip Classification and SchemaTable playwright test (#22799) * unskip the schema table test * unskip classification playwright test (cherry picked from commit 3cd9ae913b51996a1a48ccc669d05f94daca0411) --- .../playwright/e2e/Flow/SchemaTable.spec.ts | 40 ++++++++-------- .../ui/playwright/e2e/Pages/Tags.spec.ts | 47 ++++++------------- .../resources/ui/playwright/utils/entity.ts | 18 +++++-- .../main/resources/ui/playwright/utils/tag.ts | 8 +--- 4 files changed, 47 insertions(+), 66 deletions(-) diff --git a/openmetadata-ui/src/main/resources/ui/playwright/e2e/Flow/SchemaTable.spec.ts b/openmetadata-ui/src/main/resources/ui/playwright/e2e/Flow/SchemaTable.spec.ts index 5887e9ba4f7..f4cba090d24 100644 --- a/openmetadata-ui/src/main/resources/ui/playwright/e2e/Flow/SchemaTable.spec.ts +++ b/openmetadata-ui/src/main/resources/ui/playwright/e2e/Flow/SchemaTable.spec.ts @@ -104,29 +104,27 @@ const crudColumnDisplayName = async ( ); }; -// will update this tests separately -test.fixme( - 'schema table test', - async ({ dataStewardPage, ownerPage, page }) => { - const pages = [dataStewardPage, page, ownerPage]; - const tableUrl = - '/table/sample_data.ecommerce_db.shopify.performance_test_table'; - const columnFqn = - 'sample_data.ecommerce_db.shopify.performance_test_table.test_col_2000'; - const columnName = 'test_col_2000'; +test('schema table test', async ({ dataStewardPage, ownerPage, page }) => { + test.slow(); - for (const currentPage of pages) { - await currentPage.goto(tableUrl); - await currentPage.waitForLoadState('networkidle'); - await crudColumnDisplayName( - currentPage, - columnFqn, - columnName, - 'data-row-key' - ); - } + const pages = [dataStewardPage, page, ownerPage]; + const tableUrl = + '/table/sample_data.ecommerce_db.shopify.performance_test_table'; + const columnFqn = + 'sample_data.ecommerce_db.shopify.performance_test_table.test_col_2000'; + const columnName = 'test_col_2000'; + + for (const currentPage of pages) { + await currentPage.goto(tableUrl); + await currentPage.waitForLoadState('networkidle'); + await crudColumnDisplayName( + currentPage, + columnFqn, + columnName, + 'data-row-key' + ); } -); +}); test('Schema Table Pagination should work Properly', async ({ page }) => { const tableResponse = page.waitForResponse(`/api/v1/tables?limit=15**`); diff --git a/openmetadata-ui/src/main/resources/ui/playwright/e2e/Pages/Tags.spec.ts b/openmetadata-ui/src/main/resources/ui/playwright/e2e/Pages/Tags.spec.ts index 5e313ca84c2..da93a961eea 100644 --- a/openmetadata-ui/src/main/resources/ui/playwright/e2e/Pages/Tags.spec.ts +++ b/openmetadata-ui/src/main/resources/ui/playwright/e2e/Pages/Tags.spec.ts @@ -101,7 +101,7 @@ test.beforeEach(async ({ page }) => { await redirectToHomePage(page); }); -test.fixme('Classification Page', async ({ page }) => { +test('Classification Page', async ({ page }) => { test.slow(); await test.step('Should render basic elements on page', async () => { @@ -140,13 +140,9 @@ test.fixme('Classification Page', async ({ page }) => { await page.click('[data-testid="manage-button"]'); - const fetchTags = page.waitForResponse( - `/api/v1/tags?fields=usageCount&parent=${classification.responseData.name}*` - ); const disabledTag = page.waitForResponse('/api/v1/classifications/*'); await page.click('[data-testid="enable-disable-title"]'); await disabledTag; - await fetchTags; await expect( page.locator( @@ -158,10 +154,6 @@ test.fixme('Classification Page', async ({ page }) => { page.locator('[data-testid="add-new-tag-button"]') ).toBeDisabled(); - await expect( - page.locator('[data-testid="no-data-placeholder"]') - ).toBeVisible(); - // Check if the disabled Classification tag is not visible in the table await table.visitEntityPage(page); @@ -290,24 +282,15 @@ test.fixme('Classification Page', async ({ page }) => { }); await test.step('Verify classification term count', async () => { - // Navigate back to classifications list - await sidebarClick(page, SidebarItem.TAGS); - - // Wait for classifications to load with termCount field - const classificationsResponse = page.waitForResponse( - (response) => - response.url().includes('/api/v1/classifications') && - response.url().includes('fields=termCount') - ); - await classificationsResponse; - // Find the classification in the left panel and verify term count const classificationElement = page .locator(`[data-testid="side-panel-classification"]`) .filter({ hasText: NEW_CLASSIFICATION.displayName }); // Check if term count is displayed as (1) since we created one tag - await expect(classificationElement).toContainText('(1)'); + await expect(classificationElement).toContainText( + `${NEW_CLASSIFICATION.displayName}1` + ); // Click on the classification to verify await classificationElement.click(); @@ -326,7 +309,6 @@ test.fixme('Classification Page', async ({ page }) => { tagName: name, tagFqn, tagDisplayName: displayName, - tableId: table.entityResponseData?.['id'], columnNumber: 0, rowName: `${table.entity?.columns[0].name} numeric`, }); @@ -454,15 +436,11 @@ test.fixme('Classification Page', async ({ page }) => { ); // Verify term count is now 0 after deleting the tag - await sidebarClick(page, SidebarItem.TAGS); - - // Wait for classifications to reload with updated termCount - const classificationsResponse = page.waitForResponse( - (response) => - response.url().includes('/api/v1/classifications') && - response.url().includes('fields=termCount') - ); - await classificationsResponse; + await page.reload(); + await page.waitForLoadState('networkidle'); + await page.waitForSelector('[data-testid="side-panel-classification"]', { + state: 'visible', + }); // Find the classification and verify term count is 0 const classificationElement = page @@ -470,7 +448,9 @@ test.fixme('Classification Page', async ({ page }) => { .filter({ hasText: NEW_CLASSIFICATION.displayName }); // Check if term count is displayed as (0) since we deleted the tag - await expect(classificationElement).toContainText('(0)'); + await expect(classificationElement).toContainText( + `${NEW_CLASSIFICATION.displayName}0` + ); }); await test.step('Remove classification', async () => { @@ -493,7 +473,6 @@ test.fixme('Classification Page', async ({ page }) => { await page.click('[data-testid="confirm-button"]'); await deleteClassification; - await user1.visitPage(page); await page.waitForLoadState('networkidle'); await expect( @@ -560,7 +539,9 @@ test('Verify system classification term counts', async ({ page }) => { response.url().includes('fields=termCount') ); + const getTags = page.waitForResponse('/api/v1/tags*'); await sidebarClick(page, SidebarItem.TAGS); + await getTags; await classificationsResponse; diff --git a/openmetadata-ui/src/main/resources/ui/playwright/utils/entity.ts b/openmetadata-ui/src/main/resources/ui/playwright/utils/entity.ts index 678f1cfd747..87bea348356 100644 --- a/openmetadata-ui/src/main/resources/ui/playwright/utils/entity.ts +++ b/openmetadata-ui/src/main/resources/ui/playwright/utils/entity.ts @@ -1299,11 +1299,19 @@ export const updateDisplayNameForEntityChildren = async ( await page.click('[data-testid="save-button"]'); await updateRequest; - await expect( - page - .locator(`[${rowSelector}="${rowId}"]`) - .getByTestId('column-display-name') - ).toHaveText(displayName.newDisplayName); + if (displayName.newDisplayName === '') { + await expect( + page + .locator(`[${rowSelector}="${rowId}"]`) + .getByTestId('column-display-name') + ).not.toBeAttached(); + } else { + await expect( + page + .locator(`[${rowSelector}="${rowId}"]`) + .getByTestId('column-display-name') + ).toHaveText(displayName.newDisplayName); + } }; export const removeDisplayNameForEntityChildren = async ( diff --git a/openmetadata-ui/src/main/resources/ui/playwright/utils/tag.ts b/openmetadata-ui/src/main/resources/ui/playwright/utils/tag.ts index d93824befde..a96ffa36625 100644 --- a/openmetadata-ui/src/main/resources/ui/playwright/utils/tag.ts +++ b/openmetadata-ui/src/main/resources/ui/playwright/utils/tag.ts @@ -282,14 +282,12 @@ export const addTagToTableColumn = async ( tagName, tagFqn, tagDisplayName, - tableId, columnNumber, rowName, }: { tagName: string; tagFqn: string; tagDisplayName: string; - tableId: string; columnNumber: number; rowName: string; } @@ -304,11 +302,7 @@ export const addTagToTableColumn = async ( page.locator('[data-testid="tag-selector"] > .ant-select-selector') ).toContainText(tagDisplayName); - const saveAssociatedTag = page.waitForResponse( - (response) => - response.request().method() === 'PATCH' && - response.url().includes(`/api/v1/tables/${tableId}`) - ); + const saveAssociatedTag = page.waitForResponse(`/api/v1/columns/name/**`); await page.click('[data-testid="saveAssociatedTag"]'); await saveAssociatedTag;