From aa5da1e330343f5972e88f33d4390646d9504856 Mon Sep 17 00:00:00 2001 From: Shailesh Parmar Date: Fri, 3 Oct 2025 15:20:44 +0530 Subject: [PATCH] playwright: fixed permission spec failure (#23691) --- .../e2e/Features/Permission.spec.ts | 5 ++++ .../ui/playwright/utils/permission.ts | 30 +++++++------------ 2 files changed, 16 insertions(+), 19 deletions(-) diff --git a/openmetadata-ui/src/main/resources/ui/playwright/e2e/Features/Permission.spec.ts b/openmetadata-ui/src/main/resources/ui/playwright/e2e/Features/Permission.spec.ts index 13a883e064f..f93edc2e2e2 100644 --- a/openmetadata-ui/src/main/resources/ui/playwright/e2e/Features/Permission.spec.ts +++ b/openmetadata-ui/src/main/resources/ui/playwright/e2e/Features/Permission.spec.ts @@ -250,6 +250,11 @@ test('Permissions', async ({ userPage, adminPage }) => { }); await userPage.getByTestId('profiler').click(); + await userPage.waitForLoadState('networkidle'); + await userPage.waitForSelector("[data-testid='loader']", { + state: 'detached', + }); + const testCaseResponse = userPage.waitForResponse( (response) => response.url().includes('/api/v1/dataQuality/testCases/') && diff --git a/openmetadata-ui/src/main/resources/ui/playwright/utils/permission.ts b/openmetadata-ui/src/main/resources/ui/playwright/utils/permission.ts index 580408e08bd..2c2d9ca4997 100644 --- a/openmetadata-ui/src/main/resources/ui/playwright/utils/permission.ts +++ b/openmetadata-ui/src/main/resources/ui/playwright/utils/permission.ts @@ -156,32 +156,21 @@ export const validateViewPermissions = async ( } await page.click('[data-testid="sample_data"]'); - await page.waitForLoadState('domcontentloaded'); + await page.waitForLoadState('networkidle'); + await page.waitForSelector("[data-testid='loader']", { state: 'detached' }); await checkNoPermissionPlaceholder( page, /Sample Data/, permission?.viewSampleData ); await page.click('[data-testid="table_queries"]'); - await page.waitForLoadState('domcontentloaded'); + await page.waitForLoadState('networkidle'); + await page.waitForSelector("[data-testid='loader']", { state: 'detached' }); await checkNoPermissionPlaceholder(page, /Queries/, permission?.viewQueries); - const profilerResponse = page.waitForResponse( - (response) => - response.url().includes('/api/v1/tables/') && - response.url().includes('/systemProfile?') && - response.url().includes('startTs=') && - response.url().includes('endTs=') - ); await page.click('[data-testid="profiler"]'); - await profilerResponse; await page.waitForLoadState('networkidle'); - await page - .getByTestId('table-profiler-container') - .getByTestId('loader') - .waitFor({ state: 'detached' }); - await page.waitForLoadState('domcontentloaded'); - + await page.waitForSelector("[data-testid='loader']", { state: 'detached' }); await page .getByTestId('profiler-tab-left-panel') .getByText('Data Quality') @@ -190,19 +179,22 @@ export const validateViewPermissions = async ( .getByTestId('profiler-tab-left-panel') .getByText('Data Quality') .click(); - await page.waitForLoadState('domcontentloaded'); + await page.waitForLoadState('networkidle'); + await page.waitForSelector("[data-testid='loader']", { state: 'detached' }); await checkNoPermissionPlaceholder( page, /Data Observability/, permission?.viewTests ); await page.click('[data-testid="lineage"]'); - await page.waitForLoadState('domcontentloaded'); + await page.waitForLoadState('networkidle'); + await page.waitForSelector("[data-testid='loader']", { state: 'detached' }); await expect(page.locator('[data-testid="edit-lineage"]')).toBeDisabled(); await page.click('[data-testid="custom_properties"]'); - await page.waitForLoadState('domcontentloaded'); + await page.waitForLoadState('networkidle'); + await page.waitForSelector("[data-testid='loader']", { state: 'detached' }); await checkNoPermissionPlaceholder(page, /Custom Properties/); };