Skip to content

feat(tests): number screenshots by test declaration order - #628

Merged
BenPinet merged 3 commits into
nextfrom
feat/ordered_screenshots
Dec 3, 2026
Merged

BenPinet merged 3 commits into
nextfrom
feat/ordered_screenshots

Conversation

@JulienChampagnol

Copy link
Copy Markdown
Member

Summary

Screenshots are prefixed with the declaration index of their test (001-<name>.png), so a screenshot folder sorts like its test file or suite.

  • Vitest shim (tests/browser/shim/fixtures.ts): counts the tests declared in each file.
  • Playwright app test (tests/browser/helpers/app_test.ts): wrapped by orderedTest (screenshot_order.ts). Each declaration gets a screenshotIndex annotation, which screenshotPath reads. The wrapper also wraps the result of .extend(), so the apps' tests (Vease, PEGGHy) are numbered too. Numbering restarts at each test file (test.use({ suiteId })) and at each describe (one folder per shared suite). test.skip/fixme/fail/only declarations count too, so the numbers stay the same with --grep, retries and skipped tests.
  • Test locations (caller_location.ts): Playwright takes the location of a test, describe or use from the frame calling it, so a plain wrapper would locate every test in the wrapper. That breaks testInfo.file, report links and VS Code navigation. While the wrapper calls Playwright, the stack traces Playwright captures get extra frames and lose the wrapper's, so the declaring file is kept.
  • Baselines in tests/browser/tests/screenshots are renamed only (402 git mv, images unchanged).

Testing

  • grid_scale browser suite passes against the renamed baselines.
  • Vease controller + the grid_scale shared suite (Playwright, linked to this branch) pass against renamed baselines, with correct test locations.

Follow-ups

The Vease and PEGGHy baseline renames are on feat/ordered_screenshots in each repo, to push once this is released.

🤖 Generated with Claude Code

JulienChampagnol and others added 2 commits December 3, 2026 12:00
Screenshots are prefixed with the declaration index of their test (001-<name>.png) so a folder sorts like its test
file or suite. The Vitest shim counts its tests; the Playwright app test is wrapped to count declarations (per test
file and per describe) into an annotation, keeping the test locations of the declaring files.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@BenPinet
BenPinet merged commit 2d569bd into next Dec 3, 2026
35 checks passed
@BenPinet
BenPinet deleted the feat/ordered_screenshots branch December 3, 2026 16:27
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.

4 participants