Skip to content

Playwright tests: wait for the client render before opening the timeframe - #2764

Merged
jackstenglein merged 1 commit into
jackstenglein:devfrom
LucaGiancristofaro:fix/2760-flaky-recent-timeframe
Oct 21, 2026
Merged

jackstenglein merged 1 commit into
jackstenglein:devfrom
LucaGiancristofaro:fix/2760-flaky-recent-timeframe

Conversation

@LucaGiancristofaro

Copy link
Copy Markdown
Contributor

Summary

Fixes the flaky e2e test "displays correct graduations for other timeframes" in 'recent.spec.ts'. Test-only change.

The test freezes the browser clock at Sept 6, 2023, but the server renders /recent with today's date. 'RecentGraduates' builds the timeframe options from 'new Date()', so the server HTML has today's dates, the browser computes 2023 dates, and React throws the server HTML away and renders the page again in the browser. The test clicked the select as soon as the server-rendered one was visible. When that click landed before the browser render, it hit an element with no handlers that was about to be replaced, so the menu never opened and the test timed out waiting for "Graduation of 8/30/2023".

The test now first waits for the select to show "Graduation of 9/6/2023". Only the browser render has that date, so once it's there the select responds to the click.

Related Issues

Fixes #2760

Type of change

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to not work as expected)
  • Documentation update

Testing

  • New unit tests (vitest) were added
  • New playwright tests were added
  • It was not necessary to add tests due to the change being a fix to an existing playwright test. Repeating the test and having no failure was the verification run.

Demo

Not applicable: test-only change.

…he timeframe select

The server renders the timeframe options with today's date while the
test freezes the browser clock in 2023, so React renders the page again
in the browser. A click that landed before that render hit the
server-rendered select and never opened the menu. Wait until the select
shows the 2023 date first.
@LucaGiancristofaro

Copy link
Copy Markdown
Contributor Author

@jackstenglein , even in this case the pipeline is still failing because of #2759

@jackstenglein
jackstenglein merged commit 1b5ea6e into jackstenglein:dev Oct 21, 2026
1 of 2 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants