Fix : Failing activity feed test (#21814)

* fix failing activity feed flaky test

* fix flaky emoji test

* fix flaky test

---------

Co-authored-by: Shailesh Parmar <shailesh.parmar.webdev@gmail.com>
This commit is contained in:
Shrushti Polekar 2025-06-20 20:45:36 +05:30 committed by GitHub
parent f696227ead
commit 3694bf48ca
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 29 additions and 26 deletions

View File

@ -38,7 +38,6 @@ import {
visitOwnProfilePage,
} from '../../utils/common';
import { addOwner, updateDescription } from '../../utils/entity';
import { clickOnLogo } from '../../utils/sidebar';
import {
checkTaskCountInActivityFeed,
createDescriptionTask,
@ -121,32 +120,34 @@ test.describe('Activity feed', () => {
test('Emoji reaction on feed should be working fine', async ({ page }) => {
await removeLandingBanner(page);
await test.step('Add Emoji reaction', async () => {
// Assign reaction for latest feed
await reactOnFeed(page);
// Assign reaction for latest feed
await reactOnFeed(page, 1);
// Verify if reaction is working or not
for (const emoji of REACTION_EMOJIS) {
await expect(
page.locator(
'[data-testid="activity-feed-widget"] [data-testid="message-container"]:first-child [data-testid="feed-reaction-container"]'
)
).toContainText(emoji);
}
});
// Verify if reaction is working or not
for (const emoji of REACTION_EMOJIS) {
await expect(
page.locator(
'[data-testid="activity-feed-widget"] [data-testid="message-container"]:first-child [data-testid="feed-reaction-container"]'
)
).toContainText(emoji);
}
});
await test.step('Remove Emoji reaction from feed', async () => {
// Remove reaction for latest feed
await reactOnFeed(page);
test('Remove Emoji reaction from feed', async ({ page }) => {
await removeLandingBanner(page);
// Add reaction for latest feed
await reactOnFeed(page, 2);
// Verify if reaction is removed or not
const feedReactionContainer = page
.locator('[data-testid="message-container"]')
.nth(1)
.locator('[data-testid="feed-reaction-container"]');
// Remove reaction for 2nd feed
await reactOnFeed(page, 2);
await expect(feedReactionContainer).toHaveCount(1);
});
// Verify if reaction is removed or not
const feedReactionContainers = page
.locator('[data-testid="message-container"]')
.nth(2)
.locator('[data-testid="feed-reaction-container"]');
await expect(feedReactionContainers).toHaveCount(1);
});
test('Assigned task should appear to task tab', async ({ page }) => {
@ -170,7 +171,7 @@ test.describe('Activity feed', () => {
// create tag task
await createTagTask(page, { ...value, tag: 'PII.None' });
await clickOnLogo(page);
await redirectToHomePage(page);
const taskResponse = page.waitForResponse(
'/api/v1/feed?type=Task&filterType=OWNER&taskStatus=Open&userId=*'
@ -855,6 +856,8 @@ base.describe('Activity feed with Data Consumer User', () => {
// create tag task
await createTagTask(page1, value, false);
await page1.waitForLoadState('networkidle');
// Should only see the close, add and comment button
expect(
page1.locator('[data-testid="comments-input-field"]')

View File

@ -85,11 +85,11 @@ export const deleteFeedComments = async (page: Page, feed: Locator) => {
await deleteResponse;
};
export const reactOnFeed = async (page: Page) => {
export const reactOnFeed = async (page: Page, feedNumber: number) => {
for (const reaction of FEED_REACTIONS) {
await page
.locator(
'[data-testid="activity-feed-widget"] [data-testid="message-container"]:first-child'
`[data-testid="activity-feed-widget"] [data-testid="message-container"]:nth-child(${feedNumber})`
)
.locator('[data-testid="feed-reaction-container"]')
.locator('[data-testid="add-reactions"]')