From 3ea4dbd10e2924cd6b47a5f9e39e1be13c646105 Mon Sep 17 00:00:00 2001 From: Shrushti Polekar Date: Wed, 2 Apr 2025 11:08:01 +0530 Subject: [PATCH] Fix : Feeds not getting updated on user profile change. (#20486) * fix feeds not getting updated after user profile change * fix feeds call happening with aftre payload on initial load * playwright for feed user profile change --- .../Pages/ProfilerConfigurationPage.spec.ts | 2 +- .../ui/playwright/e2e/Pages/Users.spec.ts | 36 +++++++++++++++++++ .../resources/ui/playwright/utils/user.ts | 2 +- .../ActivityFeedTab.component.tsx | 16 +++++---- .../src/pages/UserPage/UserPage.component.tsx | 3 +- 5 files changed, 49 insertions(+), 10 deletions(-) diff --git a/openmetadata-ui/src/main/resources/ui/playwright/e2e/Pages/ProfilerConfigurationPage.spec.ts b/openmetadata-ui/src/main/resources/ui/playwright/e2e/Pages/ProfilerConfigurationPage.spec.ts index 146fca59955..5147fc53e88 100644 --- a/openmetadata-ui/src/main/resources/ui/playwright/e2e/Pages/ProfilerConfigurationPage.spec.ts +++ b/openmetadata-ui/src/main/resources/ui/playwright/e2e/Pages/ProfilerConfigurationPage.spec.ts @@ -10,7 +10,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -import { test as base, expect, Page } from '@playwright/test'; +import { expect, Page, test as base } from '@playwright/test'; import { PROFILER_EMPTY_RESPONSE_CONFIG, PROFILER_REQUEST_CONFIG, 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 f14611be2f0..ab5189893f8 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 @@ -449,3 +449,39 @@ test.describe('User with Data Steward Roles', () => { await visitOwnProfilePage(dataStewardPage); }); }); + +test.describe('User Profile Feed Interactions', () => { + test('Should navigate to user profile from feed card avatar click', async ({ + adminPage, + }) => { + await redirectToHomePage(adminPage); + const feedResponse = adminPage.waitForResponse( + '/api/v1/feed?type=Conversation' + ); + + await visitOwnProfilePage(adminPage); + await feedResponse; + + await adminPage.waitForSelector('[data-testid="message-container"]'); + const userDetailsResponse = adminPage.waitForResponse( + '/api/v1/users/name/*' + ); + const userFeedResponse = adminPage.waitForResponse( + '/api/v1/feed?type=Conversation&filterType=OWNER_OR_FOLLOWS&userId=*' + ); + + await adminPage + .locator('[data-testid="message-container"]') + .first() + .locator('[data-testid="profile-avatar"]') + .click(); + await userDetailsResponse; + await userFeedResponse; + const response = await userDetailsResponse; + const { fullyQualifiedName } = await response.json(); + + await expect( + adminPage.locator('[data-testid="user-display-name"]') + ).toHaveText(fullyQualifiedName); + }); +}); diff --git a/openmetadata-ui/src/main/resources/ui/playwright/utils/user.ts b/openmetadata-ui/src/main/resources/ui/playwright/utils/user.ts index a4dbb546216..9c68fd99093 100644 --- a/openmetadata-ui/src/main/resources/ui/playwright/utils/user.ts +++ b/openmetadata-ui/src/main/resources/ui/playwright/utils/user.ts @@ -19,8 +19,8 @@ import { import { VISIT_SERVICE_PAGE_DETAILS } from '../constant/service'; import { GlobalSettingOptions, - SETTING_CUSTOM_PROPERTIES_PATH, SETTINGS_OPTIONS_PATH, + SETTING_CUSTOM_PROPERTIES_PATH, } from '../constant/settings'; import { SidebarItem } from '../constant/sidebar'; import { UserClass } from '../support/user/UserClass'; diff --git a/openmetadata-ui/src/main/resources/ui/src/components/ActivityFeed/ActivityFeedTab/ActivityFeedTab.component.tsx b/openmetadata-ui/src/main/resources/ui/src/components/ActivityFeed/ActivityFeedTab/ActivityFeedTab.component.tsx index b09db415604..2b952b57607 100644 --- a/openmetadata-ui/src/main/resources/ui/src/components/ActivityFeed/ActivityFeedTab/ActivityFeedTab.component.tsx +++ b/openmetadata-ui/src/main/resources/ui/src/components/ActivityFeed/ActivityFeedTab/ActivityFeedTab.component.tsx @@ -536,13 +536,15 @@ export const ActivityFeedTab = ({ onFeedClick={handleFeedClick} /> {loader} -
} - style={{ height: '2px' }} - /> + {entityThread.length > 0 && ( +
} + style={{ height: '2px' }} + /> + )}
{ const { currentUser, updateCurrentUser } = useApplicationStore(); const fetchUserData = async () => { + setIsLoading(true); try { const res = await getUserByName(username, { fields: [ @@ -179,7 +180,7 @@ const UserPage = () => { fetchUserData(); }, [username]); - if (isLoading) { + if (userData?.name !== username || isLoading) { return ; }