From cfa38cb5ca6cbf00f173ebf59b12680eb10012a9 Mon Sep 17 00:00:00 2001 From: Gandalf Date: Wed, 7 Jan 2026 18:59:58 +0100 Subject: [PATCH] Fix flaky vote tooltip tests for posts past payout window Use toContain() instead of exact match for tooltip assertions. Posts older than 7 days show a payout warning in the tooltip, causing tests to fail when @gtg's first reply is past its payout window. The tests still validate that the correct tooltip type (Upvote/Downvote) is shown while accepting the payout warning variant. --- apps/blog/playwright/tests/e2e/mainTimeline.spec.ts | 8 ++++---- apps/blog/playwright/tests/e2e/profileRepliesPage.spec.ts | 8 ++++---- 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/apps/blog/playwright/tests/e2e/mainTimeline.spec.ts b/apps/blog/playwright/tests/e2e/mainTimeline.spec.ts index c64cfa9b8..693800825 100644 --- a/apps/blog/playwright/tests/e2e/mainTimeline.spec.ts +++ b/apps/blog/playwright/tests/e2e/mainTimeline.spec.ts @@ -757,7 +757,7 @@ test.describe('Home page tests', () => { // Wait for tooltip to be visible instead of fixed timeout await expect(homePage.getFirstPostUpvoteButtonTooltip).toBeVisible({ timeout: 15000 }); // Validate the tooltip message - expect(await homePage.getFirstPostUpvoteButtonTooltip.textContent()).toBe('UpvoteUpvote'); + expect(await homePage.getFirstPostUpvoteButtonTooltip.textContent()).toContain('Upvote'); // Upvote icon color expect( await homePage.getElementCssPropertyValue( @@ -804,7 +804,7 @@ test.describe('Home page tests', () => { // Wait for tooltip to be visible instead of fixed timeout await expect(homePage.getFirstPostUpvoteButtonTooltip).toBeVisible({ timeout: 15000 }); // Validate the tooltip message - expect(await homePage.getFirstPostUpvoteButtonTooltip.textContent()).toBe('UpvoteUpvote'); + expect(await homePage.getFirstPostUpvoteButtonTooltip.textContent()).toContain('Upvote'); // Upvote icon color expect( await homePage.getElementCssPropertyValue( @@ -858,7 +858,7 @@ test.describe('Home page tests', () => { // Wait for tooltip to be visible instead of fixed timeout await expect(homePage.getFirstPostDownvoteButtonTooltip).toBeVisible({ timeout: 15000 }); // Validate the tooltip message - expect(await homePage.getFirstPostDownvoteButtonTooltip.textContent()).toBe('DownvoteDownvote'); + expect(await homePage.getFirstPostDownvoteButtonTooltip.textContent()).toContain('Downvote'); // Downvote icon color expect( await homePage.getElementCssPropertyValue( @@ -905,7 +905,7 @@ test.describe('Home page tests', () => { // Wait for tooltip to be visible instead of fixed timeout await expect(homePage.getFirstPostDownvoteButtonTooltip).toBeVisible({ timeout: 15000 }); // Validate the tooltip message - expect(await homePage.getFirstPostDownvoteButtonTooltip.textContent()).toBe('DownvoteDownvote'); + expect(await homePage.getFirstPostDownvoteButtonTooltip.textContent()).toContain('Downvote'); // Downvote icon color expect( await homePage.getElementCssPropertyValue( diff --git a/apps/blog/playwright/tests/e2e/profileRepliesPage.spec.ts b/apps/blog/playwright/tests/e2e/profileRepliesPage.spec.ts index 5c14daa27..72be98af8 100644 --- a/apps/blog/playwright/tests/e2e/profileRepliesPage.spec.ts +++ b/apps/blog/playwright/tests/e2e/profileRepliesPage.spec.ts @@ -238,8 +238,8 @@ test.describe('Replies Tab in Profile page of @gtg', () => { // Hover upvote button await profilePage.postUpvoteButton.first().hover(); await profilePage.page.waitForTimeout(1000); - // Validate the tooltip message - expect(await profilePage.postUpvoteTooltip.textContent()).toBe('UpvoteUpvote'); + // Validate the tooltip message (may include payout warning for old posts) + expect(await profilePage.postUpvoteTooltip.textContent()).toContain('Upvote'); // Upvote icon color expect( await profilePage.getElementCssPropertyValue( @@ -270,8 +270,8 @@ test.describe('Replies Tab in Profile page of @gtg', () => { // Hover Downvote button await profilePage.postDownvoteButton.first().hover(); await profilePage.page.waitForTimeout(1000); - // Validate the tooltip message - expect(await profilePage.postDownvoteTooltip.textContent()).toBe('DownvoteDownvote'); + // Validate the tooltip message (may include payout warning for old posts) + expect(await profilePage.postDownvoteTooltip.textContent()).toContain('Downvote'); // Upvote icon color expect( await profilePage.getElementCssPropertyValue( -- GitLab