diff --git a/apps/blog/playwright/tests/e2e/comments.spec.ts b/apps/blog/playwright/tests/e2e/comments.spec.ts index 97a9506e9f6fa44d3eee596bd61dbe0ca0f10d42..4d9a2181fee998e2eac8bd21513abdc86d5f24ef 100644 --- a/apps/blog/playwright/tests/e2e/comments.spec.ts +++ b/apps/blog/playwright/tests/e2e/comments.spec.ts @@ -20,7 +20,10 @@ test.describe('Comments of post', () => { }) => { await homePage.goto(); await homePage.moveToTheFirstPostWithCommentsNumberMoreThanZero(); + await postPage.commentCardsHeaders.first().scrollIntoViewIfNeeded(); await expect(postPage.commentCardsHeaders.first()).toBeVisible(); + if (await postPage.commentCardsDescriptions.first().isHidden()) + await postPage.commentCardsHeaders.first().click(); await expect(postPage.commentCardsDescriptions.first()).toBeVisible(); await expect(postPage.commentCardsFooters.first()).toBeVisible(); }); @@ -28,6 +31,9 @@ test.describe('Comments of post', () => { test('Validate a hovered comment changes backgroundcolor style', async ({ page }) => { await homePage.goto(); await homePage.moveToTheFirstPostWithCommentsNumberMoreThanZero(); + await postPage.commentCardsHeaders.first().scrollIntoViewIfNeeded(); + if (await postPage.commentCardsDescriptions.first().isHidden()) + await postPage.commentCardsHeaders.first().click(); // Before hover expect( await postPage.getElementCssPropertyValue( @@ -56,7 +62,9 @@ test.describe('Comments of post', () => { await homePage.changeThemeMode('Dark'); await homePage.validateThemeModeIsDark(); await homePage.moveToTheFirstPostWithCommentsNumberMoreThanZero(); - + await postPage.commentCardsHeaders.first().scrollIntoViewIfNeeded(); + if (await postPage.commentCardsDescriptions.first().isHidden()) + await postPage.commentCardsHeaders.first().click(); // Before hover expect( await postPage.getElementCssPropertyValue( @@ -81,7 +89,10 @@ test.describe('Comments of post', () => { await homePage.goto(); await homePage.moveToTheFirstPostWithCommentsNumberMoreThanZero(); + await postPage.commentCardsHeaders.first().scrollIntoViewIfNeeded(); await expect(postPage.commentCardsHeaders.first()).toBeVisible(); + if (await postPage.commentCardsDescriptions.first().isHidden()) + await postPage.commentCardsHeaders.first().click(); await expect(postPage.commentCardsDescriptions.first()).toBeVisible(); await expect(postPage.commentCardsFooters.first()).toBeVisible(); diff --git a/apps/blog/playwright/tests/e2e/mainTimeline.spec.ts b/apps/blog/playwright/tests/e2e/mainTimeline.spec.ts index 6f1e67680fbeec112c1310a297f7593e8b6f38a5..c64cfa9b84f5d88f38cf1c2705cb0c6bce4643f1 100644 --- a/apps/blog/playwright/tests/e2e/mainTimeline.spec.ts +++ b/apps/blog/playwright/tests/e2e/mainTimeline.spec.ts @@ -668,16 +668,25 @@ test.describe('Home page tests', () => { await homePage.changeThemeMode('Dark'); await homePage.validateThemeModeIsDark(); await expect(homePage.loginBtn).toBeVisible(); - await expect(await homePage.getElementCssPropertyValue(await homePage.loginBtn, 'color')).toBe( + + await expect.poll(async () => { + return await homePage.getElementCssPropertyValue(await homePage.loginBtn, 'color'); + }).toBe( 'rgb(255, 255, 255)' ); - await expect(await homePage.getElementCssPropertyValue(await homePage.loginBtn, 'background-color')).toBe( + + await expect.poll(async () => { + return await homePage.getElementCssPropertyValue(await homePage.loginBtn, 'background-color'); + }).toBe( 'rgba(0, 0, 0, 0)' ); + await homePage.loginBtn.hover(); // Use toHaveCSS with auto-retry instead of fixed timeout await expect(homePage.loginBtn).toHaveCSS('color', 'rgb(226, 18, 53)'); - await expect(await homePage.getElementCssPropertyValue(await homePage.loginBtn, 'background-color')).toBe( + await expect.poll( async () => { + return await homePage.getElementCssPropertyValue(await homePage.loginBtn, 'background-color'); + }).toBe( 'rgb(29, 40, 58)' ); }); diff --git a/apps/blog/playwright/tests/e2e/profilePage.spec.ts b/apps/blog/playwright/tests/e2e/profilePage.spec.ts index 58280391722df25ceb9b0d65fdc99044a0580fcf..632bc3c8fb977854ba41b668b6f01f6cbee140c8 100644 --- a/apps/blog/playwright/tests/e2e/profilePage.spec.ts +++ b/apps/blog/playwright/tests/e2e/profilePage.spec.ts @@ -286,10 +286,14 @@ test.describe('Profile page of @gtg', () => { await homePage.changeThemeMode('Dark'); await homePage.validateThemeModeIsDark(); - expect(await profilePage.getElementCssPropertyValue(profilePage.followButton, 'color')).toBe( + expect.poll(async () => { + await profilePage.getElementCssPropertyValue(profilePage.followButton, 'color'); + }).toBe( 'rgb(2, 2, 5)' ); - expect(await profilePage.getElementCssPropertyValue(profilePage.followButton, 'background-color')).toBe( + expect.poll(async () => { + await profilePage.getElementCssPropertyValue(profilePage.followButton, 'background-color'); + }).toBe( 'rgb(248, 250, 252)' ); @@ -298,9 +302,9 @@ test.describe('Profile page of @gtg', () => { await expect.poll(async () => { return await profilePage.getElementCssPropertyValue(profilePage.followButton, 'color'); }).toBe('rgb(226, 18, 53)'); - expect( - await profilePage.getElementCssPropertyValue(await profilePage.followButton, 'background-color') - ).toBe('rgb(248, 250, 252)'); + expect.poll(async () => { + await profilePage.getElementCssPropertyValue(await profilePage.followButton, 'background-color'); + }).toBe('rgb(248, 250, 252)'); }); test("User Banner Row - Description",async ({page}) =>{ diff --git a/apps/blog/playwright/tests/e2e/profileRepliesPage.spec.ts b/apps/blog/playwright/tests/e2e/profileRepliesPage.spec.ts index 4745565758b7592c186c9db43057906791440b67..5c14daa2793aaf33327c197a346b0573173f8459 100644 --- a/apps/blog/playwright/tests/e2e/profileRepliesPage.spec.ts +++ b/apps/blog/playwright/tests/e2e/profileRepliesPage.spec.ts @@ -335,7 +335,7 @@ test.describe('Replies Tab in Profile page of @gtg', () => { await expect(firstCommentCardVote).toBeVisible(); await firstCommentCardVote.hover(); await profilePage.page.waitForTimeout(1000); - await expect(await profilePage.postVotesTooltip.nth(0)).toContainText('votesvotes'); + await expect(await profilePage.postVotesTooltip.nth(0)).toContainText(/\d+\s*votes\s*\d+\s*votes/); } else if (Number(firstCommentCardVoteText) == 1) { // equal 1 vote await expect(firstCommentCardVote).toBeVisible(); diff --git a/apps/wallet/playwright/tests/e2e/proposals.spec.ts b/apps/wallet/playwright/tests/e2e/proposals.spec.ts index 3a459217f7ae29868ee21db8d1596a7efd457628..74d6da904b9428447fd9edb0e1bd81dd5ecfdccc 100644 --- a/apps/wallet/playwright/tests/e2e/proposals.spec.ts +++ b/apps/wallet/playwright/tests/e2e/proposals.spec.ts @@ -57,7 +57,7 @@ test.describe('Proposals page tests', () => { await proposalsPage.proposalsFilterStatusConntent.getByText('All').click(); await expect(proposalsPage.proposalsFilterStatus.locator('span')).toHaveText('All'); // Wait for proposals to load after filter change - await proposalsPage.proposalListItem.first().or(proposalsPage.page.locator('text="Sorry, I can\'t show you any proposals right now."')).waitFor({ state: 'visible' }); + await proposalsPage.proposalListItem.first().or(proposalsPage.proposalMessageCannotShowYouAnyProposals).waitFor({ state: 'visible' }); if (await proposalsPage.proposalStatusBadge.first().isVisible()) { await proposalsPage.page.waitForSelector(proposalsPage.proposalListItem['_selector']); const amountProposalsItemUI = (await proposalsPage.proposalListItem.all()).length; @@ -89,7 +89,7 @@ test.describe('Proposals page tests', () => { await proposalsPage.proposalsFilterStatusConntent.getByText(/^Active$/).click(); await expect(proposalsPage.proposalsFilterStatus.locator('span')).toHaveText(/^Active$/); // Wait for proposals to load after filter change - await proposalsPage.proposalListItem.first().or(proposalsPage.page.locator('text="Sorry, I can\'t show you any proposals right now."')).waitFor({ state: 'visible' }); + await proposalsPage.proposalListItem.first().or(proposalsPage.proposalMessageCannotShowYouAnyProposals).waitFor({ state: 'visible' }); if (await proposalsPage.proposalStatusBadge.first().isVisible()) { await expect(proposalsPage.proposalStatusBadge.first()).toHaveText('started'); await proposalsPage.page.waitForSelector(proposalsPage.proposalListItem['_selector']); @@ -123,7 +123,7 @@ test.describe('Proposals page tests', () => { await proposalsPage.page.waitForSelector(proposalsPage.proposalsFilterStatus.getByText(/^Inactive$/)['_selector']); await expect(proposalsPage.proposalsFilterStatus.locator('span')).toHaveText(/^Inactive$/); // Wait for proposals to load after filter change - await proposalsPage.proposalListItem.first().or(proposalsPage.page.locator('text="Sorry, I can\'t show you any proposals right now."')).waitFor({ state: 'visible' }); + await proposalsPage.proposalListItem.first().or(proposalsPage.proposalMessageCannotShowYouAnyProposals).waitFor({ state: 'visible' }); if (await proposalsPage.proposalStatusBadge.first().isVisible()) { await proposalsPage.page.waitForSelector(proposalsPage.proposalListItem['_selector']); await expect(proposalsPage.proposalStatusBadge.first()).toHaveText('not started'); @@ -156,7 +156,7 @@ test.describe('Proposals page tests', () => { await proposalsPage.proposalsFilterStatusConntent.getByText(/^Expired$/).click(); await expect(proposalsPage.proposalsFilterStatus.locator('span')).toHaveText(/^Expired$/); // Wait for proposals to load after filter change - await proposalsPage.proposalListItem.first().or(proposalsPage.page.locator('text="Sorry, I can\'t show you any proposals right now."')).waitFor({ state: 'visible' }); + await proposalsPage.proposalListItem.first().or(proposalsPage.proposalMessageCannotShowYouAnyProposals).waitFor({ state: 'visible' }); if (await proposalsPage.proposalStatusBadge.first().isVisible()) { await expect(proposalsPage.proposalStatusBadge.first()).toHaveText('finished'); await proposalsPage.page.waitForSelector(proposalsPage.proposalListItem['_selector']); @@ -189,7 +189,7 @@ test.describe('Proposals page tests', () => { await proposalsPage.proposalsFilterStatusConntent.getByText(/^Votable$/).click(); await expect(proposalsPage.proposalsFilterStatus.locator('span')).toHaveText(/^Votable$/); // Wait for proposals to load after filter change - await proposalsPage.proposalListItem.first().or(proposalsPage.page.locator('text="Sorry, I can\'t show you any proposals right now."')).waitFor({ state: 'visible' }); + await proposalsPage.proposalListItem.first().or(proposalsPage.proposalMessageCannotShowYouAnyProposals).waitFor({ state: 'visible' }); if (await proposalsPage.proposalStatusBadge.first().isVisible()) { await proposalsPage.page.waitForSelector(proposalsPage.proposalListItem['_selector']); const amountProposalsItemUI = (await proposalsPage.proposalListItem.all()).length; @@ -265,7 +265,7 @@ test.describe('Proposals page tests', () => { await proposalsPage.proposalsFilterOrderByConntent.getByText(/^Creator$/).click(); await expect(proposalsPage.proposalsFilterOrderBy.locator('span')).toHaveText(/^Creator$/); // Wait for proposals to load after filter change - await proposalsPage.proposalListItem.first().or(proposalsPage.page.locator('text="Sorry, I can\'t show you any proposals right now."')).waitFor({ state: 'visible' }); + await proposalsPage.proposalListItem.first().or(proposalsPage.proposalMessageCannotShowYouAnyProposals).waitFor({ state: 'visible' }); if (await proposalsPage.proposalStatusBadge.first().isVisible()) { await proposalsPage.page.waitForSelector(proposalsPage.proposalListItem['_selector']); const amountProposalsItemUI = (await proposalsPage.proposalListItem.all()).length; @@ -303,7 +303,7 @@ test.describe('Proposals page tests', () => { await proposalsPage.proposalsFilterOrderByConntent.getByText(/^Start Date$/).click(); await expect(proposalsPage.proposalsFilterOrderBy.locator('span')).toHaveText(/^Start Date$/); // Wait for proposals to load after filter change - await proposalsPage.proposalListItem.first().or(proposalsPage.page.locator('text="Sorry, I can\'t show you any proposals right now."')).waitFor({ state: 'visible' }); + await proposalsPage.proposalListItem.first().or(proposalsPage.proposalMessageCannotShowYouAnyProposals).waitFor({ state: 'visible' }); if (await proposalsPage.proposalStatusBadge.first().isVisible()) { await proposalsPage.page.waitForSelector(proposalsPage.proposalListItem['_selector']); const amountProposalsItemUI = (await proposalsPage.proposalListItem.all()).length; @@ -341,7 +341,7 @@ test.describe('Proposals page tests', () => { await proposalsPage.proposalsFilterOrderByConntent.getByText(/^End Date$/).click(); await expect(proposalsPage.proposalsFilterOrderBy.locator('span')).toHaveText(/^End Date$/); // Wait for proposals to load after filter change - await proposalsPage.proposalListItem.first().or(proposalsPage.page.locator('text="Sorry, I can\'t show you any proposals right now."')).waitFor({ state: 'visible' }); + await proposalsPage.proposalListItem.first().or(proposalsPage.proposalMessageCannotShowYouAnyProposals).waitFor({ state: 'visible' }); if (await proposalsPage.proposalStatusBadge.first().isVisible()) { await proposalsPage.page.waitForSelector(proposalsPage.proposalListItem['_selector']); const amountProposalsItemUI = (await proposalsPage.proposalListItem.all()).length; @@ -379,7 +379,7 @@ test.describe('Proposals page tests', () => { await proposalsPage.proposalsFilterOrderByConntent.getByText(/^Total Votes$/).click(); await expect(proposalsPage.proposalsFilterOrderBy.locator('span')).toHaveText(/^Total Votes$/); // Wait for proposals to load after filter change - await proposalsPage.proposalListItem.first().or(proposalsPage.page.locator('text="Sorry, I can\'t show you any proposals right now."')).waitFor({ state: 'visible' }); + await proposalsPage.proposalListItem.first().or(proposalsPage.proposalMessageCannotShowYouAnyProposals).waitFor({ state: 'visible' }); if (await proposalsPage.proposalStatusBadge.first().isVisible()) { await proposalsPage.page.waitForSelector(proposalsPage.proposalListItem['_selector']); const amountProposalsItemUI = (await proposalsPage.proposalListItem.all()).length; diff --git a/apps/wallet/playwright/tests/support/pages/proposalsPage.ts b/apps/wallet/playwright/tests/support/pages/proposalsPage.ts index 3747e9b39c5df508100d65cf0c605d78decc43d3..165e5843d96d88c5aa8fadf74fef53b0cc55aaae 100644 --- a/apps/wallet/playwright/tests/support/pages/proposalsPage.ts +++ b/apps/wallet/playwright/tests/support/pages/proposalsPage.ts @@ -27,6 +27,7 @@ export class ProposalsPage { readonly proposalVoterLinkInDialogList: Locator; readonly voterValuesDialog: Locator; readonly cannotShowYouAnyProposals: Locator; + readonly proposalMessageCannotShowYouAnyProposals: Locator; constructor(page: Page) { this.page = page; @@ -65,6 +66,8 @@ export class ProposalsPage { this.proposalVoterLinkInDialogList = page.locator('[data-testid="proposal-voter-link-dialog"]'); this.voterValuesDialog = page.locator('[data-testid="voter-values-dialog"]'); this.cannotShowYouAnyProposals = page.locator('data-testid="cannot-show-you-any-proposals"'); + + this.proposalMessageCannotShowYouAnyProposals = page.locator('text="Sorry, I can\'t show you any proposals right now."') } async goToProposalsPage() { @@ -75,7 +78,7 @@ export class ProposalsPage { // Wait for proposals to load - either proposal items appear or "no proposals" message await Promise.race([ this.proposalListItem.first().waitFor({ state: 'visible', timeout: 10000 }), - this.page.locator('text="Sorry, I can\'t show you any proposals right now."').waitFor({ state: 'visible', timeout: 10000 }) + this.proposalMessageCannotShowYouAnyProposals.waitFor({ state: 'visible', timeout: 10000 }) ]).catch(() => { // If neither appears within timeout, continue anyway (data may still be loading) });