Instead of saving screenshots all directly in the screenshots directory, nest them based on where the spec file is relative to the integration directory. So if running
cypress/integration/app/login/user_spec.js
a screenshot will be saved as
cypress/screenshots/app/login/user_spec.js -- login -- users -- can log in.png.
@brian-mann What about when/if we eventually support having different folders for unit and e2e tests? Should we include the test type too to avoid collisions?
So the pattern is:
{screenshotsFolder}/{type}/{specPath}{testName}.png
with
cypress/integration/app/login/user_spec.js
saved as
cypress/screenshots/integration/app/login/user_spec.js -- login -- users -- can log in.png
Definitely don't take into account the unit vs integration stuff.
It is a good point, but I don't think we can factor that in right now.
Released in 3.0.2.
Well, this is quite a breaking change for a minor release. :/
Could you please at least update the documentation to match this behaviour?
https://docs.cypress.io/api/commands/screenshot.html does not reflect this yet.
@phryneas Sorry for the inconvenience. There has been a new section added to the screenshots docs on "Naming conventions", hopefully this helps.
Most helpful comment
Definitely don't take into account the
unitvsintegrationstuff.It is a good point, but I don't think we can factor that in right now.