From b8112338f335b5ca01245b76387679c9ca44fe4c Mon Sep 17 00:00:00 2001 From: Shrushti Polekar Date: Tue, 24 Jun 2025 22:30:08 +0530 Subject: [PATCH] Fix: Activity feed AUT failure and User flaky test (#21913) * fix flaky test * fix flaky user test * minor fix * minor fix for display name * minor fix --- .../e2e/Features/ActivityFeed.spec.ts | 6 ++++- .../ui/playwright/e2e/Pages/Users.spec.ts | 24 ++++++++++++++----- 2 files changed, 23 insertions(+), 7 deletions(-) diff --git a/openmetadata-ui/src/main/resources/ui/playwright/e2e/Features/ActivityFeed.spec.ts b/openmetadata-ui/src/main/resources/ui/playwright/e2e/Features/ActivityFeed.spec.ts index ff597c13a31..bd0e35e075d 100644 --- a/openmetadata-ui/src/main/resources/ui/playwright/e2e/Features/ActivityFeed.spec.ts +++ b/openmetadata-ui/src/main/resources/ui/playwright/e2e/Features/ActivityFeed.spec.ts @@ -906,7 +906,11 @@ base.describe('Activity feed with Data Consumer User', () => { await tagsTask.click(); await entityPageTaskTab; - expect(page2.getByText('no diff available').first()).toBeVisible(); + await page2.waitForLoadState('networkidle'); + + await expect( + page2.getByText('no diff available').first() + ).toBeVisible(); // Should see the add_close dropdown and comment button await expect( diff --git a/openmetadata-ui/src/main/resources/ui/playwright/e2e/Pages/Users.spec.ts b/openmetadata-ui/src/main/resources/ui/playwright/e2e/Pages/Users.spec.ts index a51e2f33866..416bba8330c 100644 --- a/openmetadata-ui/src/main/resources/ui/playwright/e2e/Pages/Users.spec.ts +++ b/openmetadata-ui/src/main/resources/ui/playwright/e2e/Pages/Users.spec.ts @@ -494,16 +494,28 @@ test.describe('User Profile Feed Interactions', () => { await avatar.hover(); await adminPage.waitForSelector('.ant-popover-card'); - await adminPage.getByTestId('user-name').nth(1).click(); - await userDetailsResponse; - await userFeedResponse; - const response = await userDetailsResponse; - const { fullyQualifiedName } = await response.json(); + // Ensure popover is stable and visible before clicking + await adminPage.waitForTimeout(500); // Give popover time to stabilize + + // Get the user name element and ensure it's ready for interaction + const userNameElement = adminPage.getByTestId('user-name').nth(1); + + // Click with force to handle pointer event interception + await userNameElement.click({ force: true }); + + const [response] = await Promise.all([ + userDetailsResponse, + userFeedResponse, + ]); + const { name, displayName } = await response.json(); + + // The UI shows displayName if available, otherwise falls back to name + const expectedText = displayName ?? name; await expect( adminPage.locator('[data-testid="user-display-name"]') - ).toHaveText(fullyQualifiedName); + ).toHaveText(expectedText); }); test('Close the profile dropdown after redirecting to user profile page', async ({