You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
[Question] CLI tool to interactively review & update snapshot test results #14883
Hey, at one of my projects there was a custom CLI tool that allowed interactive reviewing snapshot test results and updating the baseline images/texts. As far as I know there is something similar available for snapshot tests in Jest (Interactive Snapshot Mode).
What I mean is a CLI that will go through the test results one by one and give options to open files for review (expected, actual, diff), skip, or update the baseline (copy the actual result to the snapshots).
Is something like this already available in playwright?
And if there isn't - do you think it could be valuable to playwright users? If yes, then maybe I could write some proof of concept and create a PR.
Reacted by Max Mykhailenko, Nathan J Millar, Shubham Kanodia, Sergey Kupletsky, Vladyslav Telychko, Chiu Wei Bin, M. Scott Ford, yuya-okada527, Rui Nogueira, André Hildinger and 32 more
Piotr Gajowniczek (@piotrgajow) There is no such tool yet. You can manually go over failed screenshots in the html report, but that's it right now. We were thinking along these lines, so definitely such a tool would make sense.
If you are willing to contribute, make sure to check your idea/design/thoughts with maintainers first, to make sure your contribution will be merged.
here comes the fun and sad part about naming - PW's snapshots actually are screenshots, but jest's snapshots are HTML, so one without any hassle can locally check diff, but for screens in CI - they could be different from local ones.
GitLab (and for sure any other source control with UI ) shows the diff for pics nicely, but
there is no heatmap ( for subtle changes )
there is no easy way to revert/reject some screens
still, this is a task not for PW, I think but for source control, as I'm not sure how PW's report or something could interact with source code ( but I'd like to see such a thing too :) )
Dmitry Gozman (@dgozman) How should I check the idea with maintainers first? Are there any steps to be followed in such case?
Dmitry Munda (@dimkin-eu) What I meant was to have a CLI for the developer to help determine if changes detected for a snapshot were intended (and the snapshot should be updated) or not. And the tool I am thinking about relies on test results that PW currently creates (i.e. actual, expected and diff images). Nothing related to repositories/pipelines.
A approve Screenshot button in the test results html view might be easier to use than a new CLI tool, because the test results are usually already open. This was my idea in #17801.
Reacted by Nathan J Millar, Sergey Kupletsky, M. Scott Ford, André Hildinger, Rui Nogueira, Frank Hoffmann, Devin Elrose, e-r-n-i-e, Corinna Steinhoff, Andrew Noblet and 6 more
I feel like the new recently launched UI mode would be a great place to put something like this, in Playwright 1.34.0 you can already see the screenshot comparison in the attachments tab in the UI, so having an approve button right there where you can step through the test while updating snapshots would be great.
Reacted by André Hildinger, NgocSonNguyen, e-r-n-i-e, Corinna Steinhoff, ysydiuss, Neil Sarkar, Christoph Wanja, Isabela Moreira, M. Scott Ford, urugator and 2 more
Reacted by NgocSonNguyen, Thore Strassburg and Isabela Moreira
I want this features too. Compare with BackstopJS report and feel very envious. The html report of BackstopJS is excellent although the tool itself is not very stable to run.
In the meantime, has anyone found any third-party tools that can help with the approval workflow?
Right now I am doing "open visual diff in vscode" -> "cross eyes to check the pics are identical" -> "stage changes" -> "go to the next file". But it's not the best workflow.
Emily (@neongreen) unfortunately not. I tried to do some awkward integration with jest-image-snapshot (not do take snapshots, but for the comparison + UI part). But unfortunately their code is tightly coupled to the Jest runtime. I looked into their code and I don't see any chance to break this relationship that checks if Jest is used as test runner. 😕
For me, the DX is key. Developers should not get desensibilized and get annoyed by failing visual regression tests without a good way for them to verify what has changed to take a solid decision to accept a new baseline or not. Therefore it must be easy and intuitive to use without developers just starting to blindly confirm, just because they get annoyed.
And it should work properly in a CI pipeline too.
Reacted by Frank Hoffmann, Stanislav Grishaev and andyguthrie
2026 updated workflow option (using AI), now that AI CLIs are widespread:
a CLI that will go through the test results one by one and give options to open files for review (expected, actual, diff), skip, or update the baseline (copy the actual result to the snapshots)
Depending on the workflow that you're looking for, something like this may work for you to open the snapshots in your default image viewer on your computer and then either update the baseline or skip it (adapted from the issue description):
go through the failing snapshots in the test results one by one and prompt me to choose one of the following three options:
open the files for me to review in my default image viewer (expected, actual, diff) - if I choose this option, re-prompt me with the three options
update the baseline (copy the actual result to the snapshots)
skip
We have also used a similar prompt to update snapshots from failing CI runs in GitHub Actions (which uses Linux, so the snapshots have slightly different rendering than our local macOS machines). We do this by pasting in the URL of a failing CI run on GitHub Actions:
download the artifact from and unzip it in /tmp. go through the failing snapshots in the test results one by one and prompt me to choose one of the following three options:
open the files for me to review in my default image viewer (expected, actual, diff) - if I choose this option, re-prompt me with the three options
update the baseline (copy the actual result to the snapshots)
skip
An example URL of a failing CI run on GitHub Actions would look like this:
npx rebaseline@beta review opens your Playwright HTML report in a local page (expected / actual / diff, a slider, keyboard shortcuts) and writes only the screenshots you accept to their baseline files. npx rebaseline@beta pull does the same with the report of your last failed GitHub Actions run, so you can update -linux.png baselines from a Mac or Windows machine. It finds each baseline by content, so any snapshotPathTemplate works.
Activity
dgozman commentedon Jun 15, 2022
Piotr Gajowniczek (@piotrgajow) There is no such tool yet. You can manually go over failed screenshots in the html report, but that's it right now. We were thinking along these lines, so definitely such a tool would make sense.
If you are willing to contribute, make sure to check your idea/design/thoughts with maintainers first, to make sure your contribution will be merged.
dimkin-eu commentedon Jun 16, 2022
here comes the fun and sad part about naming - PW's
snapshotsactually are screenshots, but jest'ssnapshotsare HTML, so one without any hassle can locally check diff, but for screens in CI - they could be different from local ones.GitLab (and for sure any other source control with UI ) shows the diff for pics nicely, but
still, this is a task not for PW, I think but for source control, as I'm not sure how PW's report or something could interact with source code ( but I'd like to see such a thing too :) )
piotrgajow commentedon Jun 20, 2022
Dmitry Gozman (@dgozman) How should I check the idea with maintainers first? Are there any steps to be followed in such case?
Dmitry Munda (@dimkin-eu) What I meant was to have a CLI for the developer to help determine if changes detected for a snapshot were intended (and the snapshot should be updated) or not. And the tool I am thinking about relies on test results that PW currently creates (i.e. actual, expected and diff images). Nothing related to repositories/pipelines.
frank-swp commentedon Oct 6, 2022
A
approve Screenshotbutton in the test results html view might be easier to use than a new CLI tool, because the test results are usually already open. This was my idea in #17801.andrehil commentedon May 24, 2023
Just wondering if there's any motion regarding this issue.
I like frank-swp's idea very much.
madjam002 commentedon Jun 1, 2023
I feel like the new recently launched UI mode would be a great place to put something like this, in Playwright 1.34.0 you can already see the screenshot comparison in the attachments tab in the UI, so having an approve button right there where you can step through the test while updating snapshots would be great.
nnson0310 commentedon Jun 2, 2023
I want this features too. Compare with BackstopJS report and feel very envious. The html report of BackstopJS is excellent although the tool itself is not very stable to run.
weilbith commentedon Jul 11, 2023
Just another up-vote for this feature. Would help the developer experience so much!
neongreen commentedon May 2, 2024
In the meantime, has anyone found any third-party tools that can help with the approval workflow?
Right now I am doing "open visual diff in vscode" -> "cross eyes to check the pics are identical" -> "stage changes" -> "go to the next file". But it's not the best workflow.
weilbith commentedon May 8, 2024
Emily (@neongreen) unfortunately not. I tried to do some awkward integration with jest-image-snapshot (not do take snapshots, but for the comparison + UI part). But unfortunately their code is tightly coupled to the Jest runtime. I looked into their code and I don't see any chance to break this relationship that checks if Jest is used as test runner. 😕
neongreen commentedon May 8, 2024
I just wrote a script that goes through git diff and generates visual diffs using the same logic as playwright
if there’s interest I can post the script
weilbith commentedon May 8, 2024
For me, the DX is key. Developers should not get desensibilized and get annoyed by failing visual regression tests without a good way for them to verify what has changed to take a solid decision to accept a new baseline or not. Therefore it must be easy and intuitive to use without developers just starting to blindly confirm, just because they get annoyed.
And it should work properly in a CI pipeline too.
karlhorky commentedon May 8, 2026
2026 updated workflow option (using AI), now that AI CLIs are widespread:
This behavior can now be prompted for on the command line using Codex CLI or OpenCode or Gemini CLI or GitHub Copilot CLI or Qwen Code or Kimi Code or Claude Code.
Depending on the workflow that you're looking for, something like this may work for you to open the snapshots in your default image viewer on your computer and then either update the baseline or skip it (adapted from the issue description):
We have also used a similar prompt to update snapshots from failing CI runs in GitHub Actions (which uses Linux, so the snapshots have slightly different rendering than our local macOS machines). We do this by pasting in the URL of a failing CI run on GitHub Actions:
An example URL of a failing CI run on GitHub Actions would look like this:
I also added these prompts to my guide Playwright Tricks:
theghost1980 commentedon Oct 27, 2026
Since this was closed as not planned, I built an open-source CLI for exactly this workflow, and it's now in beta: rebaseline.
npx rebaseline@beta reviewopens your Playwright HTML report in a local page (expected / actual / diff, a slider, keyboard shortcuts) and writes only the screenshots you accept to their baseline files.npx rebaseline@beta pulldoes the same with the report of your last failed GitHub Actions run, so you can update-linux.pngbaselines from a Mac or Windows machine. It finds each baseline by content, so anysnapshotPathTemplateworks.There's a demo repository to try it in a minute. I'm the author; feedback, especially when it fails, is very welcome in the beta feedback discussion.