question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Base run generating multiple snapshot images

See original GitHub issue

When I do a base run to generate snapshots, each test is generating 2 snapshots:

  • base.png
  • base-big number.png

This creates a lot of churn in our repo because now instead of just having base.png be updated, we have a delete/create of the numbered image: image

The number changes every time I run the command to generate base images. I am using the following command to do this:

./node_modules/.bin/cypress run --env type=base --config screenshotsFolder=cypress/snapshots/base,integrationFolder=src,testFiles=\"**/*visual.test.ts\"

Is there a way to run the “base” command and only generate the base.png file for each test? Thanks!

Issue Analytics

  • State:closed
  • Created 2 years ago
  • Comments:6

github_iconTop GitHub Comments

3reactions
Big0scommented, Feb 9, 2022

Without any additional package:

"scripts": {
        "base": "./node_modules/.bin/cypress run --env type=base --config screenshotsFolder=cypress/snapshots/base",
        "postbase": "cd cypress/snapshots/base && rm -rf */*-base-*.png"
}
2reactions
mstalfoortcommented, Jan 21, 2022

at the moment I’ve fixed it (for now) this way for myself:

npm install del-cli

and added these commands in my package.json file

"scripts":
        "base": "npm run create:base && npm run clean:base",
        "create:base": "cypress run --env type=base --config screenshotsFolder=cypress/snapshots/base",
        "clean:base": "del ./cypress/snapshots/base/**/*-base-[0-9]*.png",
        "clean:base:dryrun": "del ./cypress/snapshots/base/**/*-base-[0-9]*.png --dry-run"

which in turn gives me the following situation: I run the npm run base command which generates new base images (including the ones with the timestamp in it) and when that command finishes it will remove all base images which have the timestamp in it

Read more comments on GitHub >

github_iconTop Results From Across the Web

How to use same Snapshot as a base for multiple VMs in ...
Basically, you can setup a single base image that is immutable, but shared between several VMs. Each indiviudal VM will have a differencing...
Read more >
jaredpalmer/cypress-image-snapshot - GitHub
Run Cypress with --env updateSnapshots=true in order to update the base image files for all of your tests. Preventing failures. Run Cypress with...
Read more >
Create and use OpenStack snapshots - OVHcloud Blog
A snapshot is a mechanism that allows you to create a new image from a running instance. This mainly serves two purposes:.
Read more >
Create custom images | Compute Engine Documentation
You can create custom images from source disks, images, snapshots, or images stored in Cloud Storage and use these images to create virtual...
Read more >
Base build selection - Percy Docs
Introducing base builds. When you push changes to your codebase and have Percy generate screenshots, Percy groups the screenshots in snapshots, and snapshots...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found