From 9aa194d877f10fbd589ea89ede7d29b287447ac4 Mon Sep 17 00:00:00 2001 From: Ashish Gupta Date: Wed, 3 Sep 2025 12:19:27 +0530 Subject: [PATCH] chore(ui): fix the flaky test around metric spec (#23181) * fix the flaky test around metric and customize landing * reverted the customize test * reverted the unwanted changes --- .../resources/ui/playwright/utils/metric.ts | 24 +++++++++++++++---- 1 file changed, 20 insertions(+), 4 deletions(-) diff --git a/openmetadata-ui/src/main/resources/ui/playwright/utils/metric.ts b/openmetadata-ui/src/main/resources/ui/playwright/utils/metric.ts index b986b312b6b..567ead14036 100644 --- a/openmetadata-ui/src/main/resources/ui/playwright/utils/metric.ts +++ b/openmetadata-ui/src/main/resources/ui/playwright/utils/metric.ts @@ -186,22 +186,38 @@ export const updateRelatedMetric = async ( // Wait for the metrics API call to complete const metricsResponsePromise1 = page.waitForResponse( - '/api/v1/metrics/name/*?fields=*' + `/api/v1/metrics/name/${dataAsset.entity.name}?fields=*` ); + await page - .getByRole('link', { name: dataAsset.entity.name, exact: true }) + .getByRole('button', { name: dataAsset.entity.name, exact: true }) .click(); + await metricsResponsePromise1; await page.waitForLoadState('networkidle'); await page.waitForSelector('[data-testid="loader"]', { state: 'detached' }); + await expect(page.getByTestId('entity-header-display-name')).toContainText( + dataAsset.entity.name + ); + + // Adding manual wait for,right panel to be in place + await page.waitForTimeout(1000); + // Wait for the metrics API call to complete const metricsResponsePromise2 = page.waitForResponse( - '/api/v1/metrics/name/*?fields=*' + `/api/v1/metrics/name/${title}?fields=*` ); - await page.getByRole('link', { name: title }).click(); + await page.getByRole('button', { name: title, exact: true }).click(); await metricsResponsePromise2; + + await page.waitForLoadState('networkidle'); + await page.waitForSelector('[data-testid="loader"]', { state: 'detached' }); + + await expect(page.getByTestId('entity-header-display-name')).toContainText( + title + ); }; export const addMetric = async (page: Page) => {