Skip to content

fix(browser): keep failure screenshot per attempt - #11694

Merged
sheremet-va merged 25 commits into
mainfrom
fix/issue-11614
Oct 23, 2026
Merged

sheremet-va merged 25 commits into
mainfrom
fix/issue-11614

Conversation

@hi-ogawa

@hi-ogawa hi-ogawa commented Oct 22, 2026 •

Copy link
Copy Markdown
Collaborator

When a browser test failed on several retries, every attempt wrote its failure screenshot to the same file, and the reporter output listed that file under every attempt's error.

This PR saves failure screenshots of tests with retry or repeats as <test>-<repeat>-<retry>.png, like trace files. Tests without them are still saved as <test>.png.

In the reporter output, errors and screenshots are now matched by attempt, so each error lists only the screenshot of the attempt that produced it.


For the repro in the issue (a test with retry: 2), the reporter output changes like this (diff and code frame omitted):

Before:

 FAIL  |chromium| basic.test.ts > retried
AssertionError: expected 1 to be 10
Failure screenshot:
  - .vitest/attachments/failure-screenshots/basic.test.ts/retried.png
⎯⎯⎯[1/3]⎯
 FAIL  |chromium| basic.test.ts > retried
AssertionError: expected 2 to be 10
Failure screenshot:
  - .vitest/attachments/failure-screenshots/basic.test.ts/retried.png
⎯⎯⎯[2/3]⎯
 FAIL  |chromium| basic.test.ts > retried
AssertionError: expected 3 to be 10
Failure screenshot:
  - .vitest/attachments/failure-screenshots/basic.test.ts/retried.png
⎯⎯⎯[3/3]⎯

After:

 FAIL  |chromium| basic.test.ts > retried
AssertionError: expected 1 to be 10
Failure screenshot:
  - .vitest/attachments/failure-screenshots/basic.test.ts/retried-0-0.png  👈 
⎯⎯⎯[1/3]⎯
 FAIL  |chromium| basic.test.ts > retried
AssertionError: expected 2 to be 10
Failure screenshot:
  - .vitest/attachments/failure-screenshots/basic.test.ts/retried-0-1.png  👈 
⎯⎯⎯[2/3]⎯
 FAIL  |chromium| basic.test.ts > retried
AssertionError: expected 3 to be 10
Failure screenshot:
  - .vitest/attachments/failure-screenshots/basic.test.ts/retried-0-2.png  👈 
⎯⎯⎯[3/3]⎯

hi-ogawa and others added 25 commits October 20, 2026 15:57
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@sheremet-va
sheremet-va merged commit a502265 into main Oct 23, 2026
63 of 64 checks passed
@sheremet-va
sheremet-va deleted the fix/issue-11614 branch October 23, 2026 01:13
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.

Failure screenshot of a retried test always shows the last attempt

2 participants