Unskip activity feed widgets E2E tests (#23024)

* Unskip activity feed widgets E2E tests

* minor fix
This commit is contained in:
Harshit Shah 2025-08-28 11:10:18 +05:30 committed by GitHub
parent cfaa4555bc
commit cdf9f6ed3b
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 360 additions and 1231 deletions

View File

@ -26,8 +26,9 @@ export const FEED_REACTIONS = [
'eyes', 'eyes',
'rocket', 'rocket',
]; ];
export const FIRST_FEED_SELECTOR = // Returns the nth feed message container (0-based) regardless of page context (widget, drawer, or full page)
'[data-testid="activity-feed-widget"] [data-testid="message-container"]:first-child'; const getNthFeedMessage = (page: Page, indexZeroBased: number) =>
page.locator('[data-testid="message-container"]').nth(indexZeroBased);
export const checkDescriptionInEditModal = async ( export const checkDescriptionInEditModal = async (
page: Page, page: Page,
@ -86,14 +87,19 @@ export const deleteFeedComments = async (page: Page, feed: Locator) => {
}; };
export const reactOnFeed = async (page: Page, feedNumber: number) => { export const reactOnFeed = async (page: Page, feedNumber: number) => {
// Ensure at least one message exists; the caller usually checks, but we guard here
const message = getNthFeedMessage(page, Math.max(0, feedNumber - 1));
await expect(message).toBeVisible();
for (const reaction of FEED_REACTIONS) { for (const reaction of FEED_REACTIONS) {
await page const addReactionButton = message
.locator(
`[data-testid="activity-feed-widget"] [data-testid="message-container"]:nth-child(${feedNumber})`
)
.locator('[data-testid="feed-reaction-container"]') .locator('[data-testid="feed-reaction-container"]')
.locator('[data-testid="add-reactions"]') .locator('[data-testid="add-reactions"]');
.click();
await expect(addReactionButton).toBeVisible();
await addReactionButton.click();
await page await page
.locator('.ant-popover-feed-reactions .ant-popover-inner-content') .locator('.ant-popover-feed-reactions .ant-popover-inner-content')
@ -122,10 +128,11 @@ export const addMentionCommentInFeed = async (
await page.waitForSelector('[data-testid="loader"]', { state: 'detached' }); await page.waitForSelector('[data-testid="loader"]', { state: 'detached' });
await page const firstMessage = getNthFeedMessage(page, 0);
.locator(FIRST_FEED_SELECTOR)
.locator('[data-testid="reply-count"]') await expect(firstMessage).toBeVisible();
.click();
await firstMessage.locator('[data-testid="reply-count"]').click();
await page.waitForSelector('.ant-drawer-content', { await page.waitForSelector('.ant-drawer-content', {
state: 'visible', state: 'visible',
}); });