Fix flaky e2e tests: Replace waitForTimeout with proper Playwright waits

Summary

This MR fixes flaky e2e tests by replacing arbitrary waitForTimeout calls with proper Playwright wait mechanisms. The changes significantly improve test reliability by using deterministic waits instead of fixed delays.

Key Changes

Playwright Wait Patterns Applied:

  • expect.poll() - Used to wait for CSS property changes (hover effects, background colors, translations)
  • waitForSelector() - Used to wait for elements to appear in the DOM
  • waitForURL() - Used to wait for navigation completion
  • .or().waitFor() - Used to wait for multiple possible states (e.g., proposals list OR "no proposals" message)
  • toHaveText() - Used for auto-waiting text content assertions
  • waitForLoadState('networkidle') - Used for visual regression screenshot tests

Files Modified:

Wallet App:

  • wallet.spec.ts - Removed redundant timeouts before waitForSelector
  • witnesses.spec.ts - Replaced timeouts with expect.poll() for CSS changes, toHaveText() for translations
  • proposals.spec.ts - Replaced 14+ timeouts with .or().waitFor() pattern for filter changes
  • proposalsPage.ts - Updated goToProposalsPage() to use Promise.race
  • witnessesPage.ts - Updated goToWitnessesPage() to wait for first witness name

Blog App:

  • profilePage.spec.ts - Replaced timeouts with expect.poll() for hover color changes
  • profileNotificationsPage.spec.ts - Replaced timeouts with waitForURL(), expect.poll()
  • witnessesPage.spec.ts - Replaced timeouts with expect.poll() for highlight effects
  • translation.spec.ts - Replaced timeouts with proper visibility/text assertions
  • communitiesExplorePage.spec.ts - Replaced timeouts with waitFor(), expect.poll()
  • apiEndpointHealthchecker.spec.ts - Removed redundant timeout, added expect.poll()
  • faqPage.spec.ts - Replaced timeouts with waitForLoadState('networkidle')
  • postPage.spec.ts - Replaced timeouts with expect.poll() for hover effects

Test Results

3 consecutive passing pipelines:

  • Pipeline 141334 - PASSED
  • Pipeline 141340 - PASSED
  • Pipeline 141343 - PASSED

Impact

  • Reduced flakiness in e2e tests by eliminating race conditions
  • Tests now wait for actual conditions instead of arbitrary time delays
  • Improved CI reliability and reduced false failures

Merge request reports

Loading