From 3c1a6bdec5b572ab84f6b725a1e712f4c9e7f153 Mon Sep 17 00:00:00 2001 From: Shailesh Parmar Date: Thu, 12 Sep 2024 14:38:25 +0530 Subject: [PATCH 1/2] playwright: fixed failing aut test in main --- .../ui/playwright/e2e/Pages/MyData.spec.ts | 14 ++++++-------- .../resources/ui/playwright/e2e/Pages/Tags.spec.ts | 4 ++-- .../ui/playwright/e2e/Pages/TestSuite.spec.ts | 2 ++ .../main/resources/ui/playwright/utils/myData.ts | 2 +- .../TestSuitePipelineTab.component.tsx | 1 + .../IngestionListTable.interface.ts | 1 + .../IngestionListTable/IngestionListTable.tsx | 2 ++ .../src/main/resources/ui/src/styles/app.less | 3 ++- 8 files changed, 17 insertions(+), 12 deletions(-) diff --git a/openmetadata-ui/src/main/resources/ui/playwright/e2e/Pages/MyData.spec.ts b/openmetadata-ui/src/main/resources/ui/playwright/e2e/Pages/MyData.spec.ts index 0100e3e9cb5a..f0d27072167b 100644 --- a/openmetadata-ui/src/main/resources/ui/playwright/e2e/Pages/MyData.spec.ts +++ b/openmetadata-ui/src/main/resources/ui/playwright/e2e/Pages/MyData.spec.ts @@ -79,11 +79,10 @@ test.describe('My Data page', () => { await test.step('Verify my data widget', async () => { await redirectToHomePage(page); // Verify total count - const totalCount = await page - .locator('[data-testid="my-data-total-count"]') - .innerText(); - expect(totalCount).toBe('(20)'); + await expect( + page.locator('[data-testid="my-data-total-count"]') + ).toContainText('(20)'); await page .locator('[data-testid="my-data-widget"] [data-testid="view-all-link"]') @@ -100,11 +99,10 @@ test.describe('My Data page', () => { await test.step('Verify following widget', async () => { await redirectToHomePage(page); // Verify total count - const totalCount = await page - .locator('[data-testid="following-data-total-count"]') - .innerText(); - expect(totalCount).toBe('(20)'); + await expect( + page.locator('[data-testid="following-data-total-count"]') + ).toContainText('(20)'); await page.locator('[data-testid="following-data"]').click(); 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 48e38f724f73..597049a08118 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 @@ -53,8 +53,6 @@ const permanentDeleteModal = async (page: Page, entity: string) => { await page.click('[data-testid="confirm-button"]'); }; -test.describe.configure({ mode: 'serial' }); - // use the admin user to login test.use({ storageState: 'playwright/.auth/admin.json' }); @@ -77,6 +75,8 @@ test.beforeEach(async ({ page }) => { }); test('Classification Page', async ({ page }) => { + test.slow(); + await test.step('Should render basic elements on page', async () => { const getTags = page.waitForResponse('/api/v1/tags*'); await sidebarClick(page, SidebarItem.TAGS); diff --git a/openmetadata-ui/src/main/resources/ui/playwright/e2e/Pages/TestSuite.spec.ts b/openmetadata-ui/src/main/resources/ui/playwright/e2e/Pages/TestSuite.spec.ts index 73f7ac03fd45..2ab7655c0258 100644 --- a/openmetadata-ui/src/main/resources/ui/playwright/e2e/Pages/TestSuite.spec.ts +++ b/openmetadata-ui/src/main/resources/ui/playwright/e2e/Pages/TestSuite.spec.ts @@ -55,6 +55,8 @@ test.beforeEach(async ({ page }) => { }); test('Logical TestSuite', async ({ page }) => { + test.slow(); + const NEW_TEST_SUITE = { name: `mysql_matrix-${uuid()}`, description: 'mysql critical matrix', diff --git a/openmetadata-ui/src/main/resources/ui/playwright/utils/myData.ts b/openmetadata-ui/src/main/resources/ui/playwright/utils/myData.ts index 42e5984528b3..36f40142d87c 100644 --- a/openmetadata-ui/src/main/resources/ui/playwright/utils/myData.ts +++ b/openmetadata-ui/src/main/resources/ui/playwright/utils/myData.ts @@ -19,8 +19,8 @@ export const verifyEntities = async ( tables: TableClass[] ) => { // Change pagination size to 25 - const fetchResponse = page.waitForResponse(url); await page.locator('[data-testid="pagination"] .ant-btn-default').click(); + const fetchResponse = page.waitForResponse(url); await page.locator('[role="menu"] [value="25"]').click(); await fetchResponse; diff --git a/openmetadata-ui/src/main/resources/ui/src/components/DataQuality/TestSuite/TestSuitePipelineTab/TestSuitePipelineTab.component.tsx b/openmetadata-ui/src/main/resources/ui/src/components/DataQuality/TestSuite/TestSuitePipelineTab/TestSuitePipelineTab.component.tsx index cd6cb537095f..bbfae7d4cee4 100644 --- a/openmetadata-ui/src/main/resources/ui/src/components/DataQuality/TestSuite/TestSuitePipelineTab/TestSuitePipelineTab.component.tsx +++ b/openmetadata-ui/src/main/resources/ui/src/components/DataQuality/TestSuite/TestSuitePipelineTab/TestSuitePipelineTab.component.tsx @@ -245,6 +245,7 @@ const TestSuitePipelineTab = ({ testSuite }: Props) => { pipelineIdToFetchStatus={pipelineIdToFetchStatus} serviceCategory={ServiceCategory.DATABASE_SERVICES} serviceName={getServiceFromTestSuiteFQN(testSuiteFQN)} + tableClassName="test-suite-pipeline-tab" triggerIngestion={handleTriggerIngestion} onIngestionWorkflowsUpdate={getAllIngestionWorkflows} /> diff --git a/openmetadata-ui/src/main/resources/ui/src/components/Settings/Services/Ingestion/IngestionListTable/IngestionListTable.interface.ts b/openmetadata-ui/src/main/resources/ui/src/components/Settings/Services/Ingestion/IngestionListTable/IngestionListTable.interface.ts index 86d3dfeae4ca..e059b0f8fd23 100644 --- a/openmetadata-ui/src/main/resources/ui/src/components/Settings/Services/Ingestion/IngestionListTable/IngestionListTable.interface.ts +++ b/openmetadata-ui/src/main/resources/ui/src/components/Settings/Services/Ingestion/IngestionListTable/IngestionListTable.interface.ts @@ -55,4 +55,5 @@ export interface IngestionListTableProps { text: string, record: IngestionPipeline ) => ReactNode; + tableClassName?: string; } diff --git a/openmetadata-ui/src/main/resources/ui/src/components/Settings/Services/Ingestion/IngestionListTable/IngestionListTable.tsx b/openmetadata-ui/src/main/resources/ui/src/components/Settings/Services/Ingestion/IngestionListTable/IngestionListTable.tsx index 86f9d426e581..f52757a4cff0 100644 --- a/openmetadata-ui/src/main/resources/ui/src/components/Settings/Services/Ingestion/IngestionListTable/IngestionListTable.tsx +++ b/openmetadata-ui/src/main/resources/ui/src/components/Settings/Services/Ingestion/IngestionListTable/IngestionListTable.tsx @@ -79,6 +79,7 @@ function IngestionListTable({ showDescriptionCol, triggerIngestion, customRenderNameField, + tableClassName, }: Readonly) { const { t } = useTranslation(); const { theme } = useApplicationStore(); @@ -333,6 +334,7 @@ function IngestionListTable({ Date: Thu, 12 Sep 2024 16:57:36 +0530 Subject: [PATCH 2/2] fix myData spec failure --- .../ui/playwright/e2e/Pages/MyData.spec.ts | 103 ++++++++---------- .../playwright/support/entity/TableClass.ts | 12 ++ .../resources/ui/playwright/utils/common.ts | 6 + 3 files changed, 66 insertions(+), 55 deletions(-) diff --git a/openmetadata-ui/src/main/resources/ui/playwright/e2e/Pages/MyData.spec.ts b/openmetadata-ui/src/main/resources/ui/playwright/e2e/Pages/MyData.spec.ts index f0d27072167b..483f94272d0b 100644 --- a/openmetadata-ui/src/main/resources/ui/playwright/e2e/Pages/MyData.spec.ts +++ b/openmetadata-ui/src/main/resources/ui/playwright/e2e/Pages/MyData.spec.ts @@ -14,8 +14,7 @@ import { expect, Page, test as base } from '@playwright/test'; import { TableClass } from '../../support/entity/TableClass'; import { UserClass } from '../../support/user/UserClass'; import { performAdminLogin } from '../../utils/admin'; -import { redirectToHomePage } from '../../utils/common'; -import { addMultiOwner, followEntity } from '../../utils/entity'; +import { redirectToHomePage, removeLandingBanner } from '../../utils/common'; import { verifyEntities } from '../../utils/myData'; const user = new UserClass(); @@ -38,6 +37,25 @@ test.describe('My Data page', () => { await user.create(apiContext); for (const table of TableEntities) { await table.create(apiContext); + await table.patch({ + apiContext, + patchData: [ + { + op: 'add', + path: '/owners/0', + value: { + id: user.responseData.id, + type: 'user', + deleted: false, + displayName: user.responseData.displayName, + fullyQualifiedName: user.responseData.fullyQualifiedName, + href: user.responseData['href'] ?? '', + name: user.responseData.name, + }, + }, + ], + }); + await table.followTable(apiContext, user.responseData.id); } await afterAction(); }); @@ -53,65 +71,40 @@ test.describe('My Data page', () => { test.beforeEach('Visit entity details page', async ({ page }) => { await redirectToHomePage(page); + await removeLandingBanner(page); }); - test('Verify MyData and Following widget', async ({ page }) => { - test.slow(true); + test('Verify my data widget', async ({ page }) => { + // Verify total count + await expect( + page.locator('[data-testid="my-data-total-count"]') + ).toContainText('(20)'); - await test.step( - 'Set user as the Owner of the Table and also Follow it', - async () => { - for (const table of TableEntities) { - await table.visitEntityPage(page); - await addMultiOwner({ - page, - ownerNames: [user.getUserName()], - activatorBtnDataTestId: 'edit-owner', - resultTestId: 'data-assets-header', - endpoint: table.endpoint, - type: 'Users', - }); - await followEntity(page, table.endpoint); - } - } - ); - - await test.step('Verify my data widget', async () => { - await redirectToHomePage(page); - // Verify total count - - await expect( - page.locator('[data-testid="my-data-total-count"]') - ).toContainText('(20)'); - - await page - .locator('[data-testid="my-data-widget"] [data-testid="view-all-link"]') - .click(); + await page + .locator('[data-testid="my-data-widget"] [data-testid="view-all-link"]') + .click(); - // Verify entities - await verifyEntities( - page, - '/api/v1/search/query?q=*&index=all&from=0&size=25', - TableEntities - ); - }); - - await test.step('Verify following widget', async () => { - await redirectToHomePage(page); - // Verify total count + // Verify entities + await verifyEntities( + page, + '/api/v1/search/query?q=*&index=all&from=0&size=25', + TableEntities + ); + }); - await expect( - page.locator('[data-testid="following-data-total-count"]') - ).toContainText('(20)'); + test('Verify following widget', async ({ page }) => { + // Verify total count + await expect( + page.locator('[data-testid="following-data-total-count"]') + ).toContainText('(20)'); - await page.locator('[data-testid="following-data"]').click(); + await page.locator('[data-testid="following-data"]').click(); - // Verify entities - await verifyEntities( - page, - '/api/v1/search/query?q=*followers:*&index=all&from=0&size=25', - TableEntities - ); - }); + // Verify entities + await verifyEntities( + page, + '/api/v1/search/query?q=*followers:*&index=all&from=0&size=25', + TableEntities + ); }); }); diff --git a/openmetadata-ui/src/main/resources/ui/playwright/support/entity/TableClass.ts b/openmetadata-ui/src/main/resources/ui/playwright/support/entity/TableClass.ts index 6e3c88b79217..73446e9f61d9 100644 --- a/openmetadata-ui/src/main/resources/ui/playwright/support/entity/TableClass.ts +++ b/openmetadata-ui/src/main/resources/ui/playwright/support/entity/TableClass.ts @@ -302,6 +302,18 @@ export class TableClass extends EntityClass { }; } + async followTable(apiContext: APIRequestContext, userId: string) { + await apiContext.put( + `/api/v1/tables/${this.entityResponseData?.['id']}/followers`, + { + data: userId, + headers: { + 'Content-Type': 'application/json', + }, + } + ); + } + async delete(apiContext: APIRequestContext) { const serviceResponse = await apiContext.delete( `/api/v1/services/databaseServices/name/${encodeURIComponent( diff --git a/openmetadata-ui/src/main/resources/ui/playwright/utils/common.ts b/openmetadata-ui/src/main/resources/ui/playwright/utils/common.ts index 8b30549011d9..2b264e25b866 100644 --- a/openmetadata-ui/src/main/resources/ui/playwright/utils/common.ts +++ b/openmetadata-ui/src/main/resources/ui/playwright/utils/common.ts @@ -57,6 +57,12 @@ export const redirectToHomePage = async (page: Page) => { await page.waitForURL('**/my-data'); }; +export const removeLandingBanner = async (page: Page) => { + const widgetResponse = page.waitForResponse('/api/v1/search/query?q=**'); + await page.click('[data-testid="welcome-screen-close-btn"]'); + await widgetResponse; +}; + export const createNewPage = async (browser: Browser) => { // create a new page const page = await browser.newPage();