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',
'rocket',
];
export const FIRST_FEED_SELECTOR =
'[data-testid="activity-feed-widget"] [data-testid="message-container"]:first-child';
// Returns the nth feed message container (0-based) regardless of page context (widget, drawer, or full page)
const getNthFeedMessage = (page: Page, indexZeroBased: number) =>
page.locator('[data-testid="message-container"]').nth(indexZeroBased);
export const checkDescriptionInEditModal = async (
page: Page,
@ -86,14 +87,19 @@ export const deleteFeedComments = async (page: Page, feed: Locator) => {
};
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) {
await page
.locator(
`[data-testid="activity-feed-widget"] [data-testid="message-container"]:nth-child(${feedNumber})`
)
const addReactionButton = message
.locator('[data-testid="feed-reaction-container"]')
.locator('[data-testid="add-reactions"]')
.click();
.locator('[data-testid="add-reactions"]');
await expect(addReactionButton).toBeVisible();
await addReactionButton.click();
await page
.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
.locator(FIRST_FEED_SELECTOR)
.locator('[data-testid="reply-count"]')
.click();
const firstMessage = getNthFeedMessage(page, 0);
await expect(firstMessage).toBeVisible();
await firstMessage.locator('[data-testid="reply-count"]').click();
await page.waitForSelector('.ant-drawer-content', {
state: 'visible',
});