Skip to content

[Feature]: Add flag to update reference screenshots from latest test results without re-running tests #34376

Open
@mag09

Description

🚀 Feature Request

Current Behavior

To update reference screenshots after detecting UI changes, we need to:

  1. Run tests first time - differences are detected and stored in test-results folder
  2. Run tests second time with -u or --update-snapshots flag to update reference images
    This means running the same tests twice, which is time-consuming.

Proposed Solution

Add new flag --update-snapshots-latest-run that would:

  1. Take actual screenshots from test-results folder of the latest test run
  2. Update reference images using these screenshots
  3. Do this without running tests again

Example

bash# First run - detect differences
$ npm test

# Update references using screenshots from test-results folder
$ npm test --update-snapshots-latest-run

Motivation

Benefits

  • Eliminates need for second test run
  • Saves significant time on reference image updates
  • Uses already existing screenshots from test-results folder
  • Perfect for updating multiple screenshots after intended UI changes

Technical Details

  • The flag would look for latest screenshots in test-results directory
  • Only failed screenshot comparisons would be updated
  • No test execution required

Would you consider implementing this optimization? It would significantly improve the workflow when updating reference images.

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions