-
Notifications
You must be signed in to change notification settings - Fork 3.3k
New issue
Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? # to your account
Screenshot fixes/enhancements #1858
Screenshot fixes/enhancements #1858
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
So on a cursory review - it seems like you're doing a lot of backflips to get the specPath
out of the driver and passing it around to the server.
It is almost certainly easier to handle the specPath
through the server itself - so you don't have to parse out anything from the driver or URL, etc.
But I say this with a grain of salt that I have not looked into doing this, and maybe you saw that this was more difficult.
My assumption was that you didn't need to change anything on the driver
end and that this could be all implemented inside of server/lib/screenshot
minus the notion of the automatic failure screenshot.
Some of the changes regarding the spec path is refactoring, so not everything in the diff is necessarily related to the screenshot path. We were already parsing the spec path out of the URL. It's more-or-less the source of truth for the currently selected spec. AFAIK, the only place we hold onto the currently running spec in the server is in That said, I'm open to a better solution if there is one. |
@chrisbreiding right. So it's currently architected that way, but with the new 3.0 spec isolation changes it should be trivial to bootstrap the spec into the driver. That would get rid of parsing the URL entirely (you'd just get it from this state) and we could expose a property on Cypress: I get that in interactive mode it's a bit trickier holding onto the open spec than say run mode, but it'll likely be cleaner keeping all the state in a single place. I can take it from here - just wanted to make sure I wasn't missing something. |
This will require some updates to the documentation. I opened an issue here: cypress-io/cypress-documentation#671 |
…d of a string path - store state on the project for current spec + browsers - simplify how desktop gui passes around spec object - fixes #1921 - make all specs a real spec model - rename ‘Run all tests’ to ‘Run all specs’
…enhancements' into issue-1766-1771-1826-screenshot-enhancements
@brian-mann I have added types for also trimmed duplicate kitchensink code |
…enhancements' into issue-1766-1771-1826-screenshot-enhancements
I'm making a few changes here:
|
- use { testFailure: true } to indicate a failing test screenshot for use in props
Fixes #1766
If multiple non-named screenshots are taken in a single test, after the first one they're appended with a number, i.e.
test name (1).png
.Fixes #1771
Passing
foo/bar/baz
as the name of specapp.spec.js
will result in the screenshot being saved toscreenshots/app.spec.js/foo/bar/baz.png
.Fixes #1826
By default, screenshots will be saved in a directory structure matching the spec's path.
cypress/integration/foo/bar/baz_spec.js
will save a screenshot asscreenshots/foo/bar/baz_spec.js/test name.png
.Fixes #1923
We now append
-- failed
to screenshots taken automatically during failureAlso fixes #1919 and #1918
Documentation PR: cypress-io/cypress-documentation#675
closes #1881