Skip to content

Name failure screenshots after the failing test - #169

Open
jacekzlotnicki wants to merge 2 commits into
playwright-php:mainfrom
jacekzlotnicki:fix/failure-screenshot-name
Open

Name failure screenshots after the failing test#169
jacekzlotnicki wants to merge 2 commits into
playwright-php:mainfrom
jacekzlotnicki:fix/failure-screenshot-name

Conversation

@jacekzlotnicki

Copy link
Copy Markdown

PHPUnit 10 renamed getName() to name(), so the method_exists() check in tearDownPlaywright() always fell through to the 'test' default. With more than one failing test in a run, every screenshot overwrote the previous one and the evidence was gone by the time the run finished.

resolveTestName() asks name() first and falls back to getName(), so the trait keeps working on PHPUnit 9 as well. The name ends up in a file name and a data set turns it into something like testFoo with data set "a/b", so it is sanitized before use.

PHPUnit 10 renamed getName() to name(), so the method_exists() check in
tearDownPlaywright() always fell through to the 'test' default. With more than
one failing test in a run, every screenshot overwrote the previous one and the
evidence was gone by the time the run finished.

resolveTestName() asks name() first and falls back to getName(), so the trait
keeps working on PHPUnit 9 as well. The name ends up in a file name and a data
set turns it into something like `testFoo with data set "a/b"`, so it is
sanitized before use.
@codecov

codecov Bot commented Sep 10, 2026

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 92.30769% with 1 line in your changes missing coverage. Please review.

Files with missing lines Patch % Lines
src/Testing/PlaywrightTestCaseTrait.php 92.30% 1 Missing ⚠️

📢 Thoughts on this report? Let us know!

The loop skipping a missing accessor and the final default were the two lines
Codecov reported as uncovered.
@jacekzlotnicki
jacekzlotnicki force-pushed the fix/failure-screenshot-name branch from 9fe1f39 to b2695c6 Compare September 10, 2026 19: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.

1 participant