-
Notifications
You must be signed in to change notification settings - Fork 3.2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
unhelpful error message when taking screenshot of element with zero height #5149
Labels
Comments
cypress-bot
bot
added
the
stage: ready for work
The issue is reproducible and in scope
label
Sep 17, 2019
@egrubbs Thanks for the thorough debugging work. I can recreate this as you described. <!DOCTYPE html>
<html>
<body>
<div class='zero_height_element' style='height: 0'>abc</div>
</body>
</html> it('screenshot zero height el', () => {
cy.visit('index.html')
cy.get('.zero_height_element').screenshot();
}) We would love an open PR - even one that is a work in progress is fine. Check out our contributing doc and ask us if you get stuck. |
jennifer-shehane
added
topic: screenshots 📸
pkg/driver
This is due to an issue in the packages/driver directory
labels
Sep 17, 2019
5 tasks
cypress-bot
bot
added
stage: work in progress
and removed
stage: ready for work
The issue is reproducible and in scope
labels
Sep 25, 2019
NMinhNguyen
added a commit
to sebinsua/cypress
that referenced
this issue
Sep 26, 2019
Closes cypress-io#5149 Co-authored-by: Minh Nguyen <[email protected]> Co-authored-by: Jennifer Shehane <[email protected]>
NMinhNguyen
added a commit
to sebinsua/cypress
that referenced
this issue
Sep 27, 2019
Closes cypress-io#5149 Co-authored-by: Minh Nguyen <[email protected]> Co-authored-by: Jennifer Shehane <[email protected]>
NMinhNguyen
added a commit
to sebinsua/cypress
that referenced
this issue
Sep 27, 2019
Closes cypress-io#5149 Co-authored-by: Minh Nguyen <[email protected]> Co-authored-by: Jennifer Shehane <[email protected]>
NMinhNguyen
added a commit
to sebinsua/cypress
that referenced
this issue
Sep 30, 2019
Closes cypress-io#5149 Co-authored-by: Minh Nguyen <[email protected]> Co-authored-by: Jennifer Shehane <[email protected]>
cypress-bot
bot
added
stage: needs review
The PR code is done & tested, needs review
and removed
stage: work in progress
labels
Oct 1, 2019
jennifer-shehane
pushed a commit
that referenced
this issue
Oct 11, 2019
* Handle 0px tall elements with a better error message Closes #5149 Co-authored-by: Minh Nguyen <[email protected]> Co-authored-by: Jennifer Shehane <[email protected]> * Add padding support to element#screenshot Closes #4440 Co-authored-by: Minh Nguyen <[email protected]> Co-authored-by: Jennifer Shehane <[email protected]> * add e2e tests
cypress-bot
bot
added
stage: pending release
and removed
stage: needs review
The PR code is done & tested, needs review
labels
Oct 11, 2019
The code for this is done in cypress-io/cypress#5078, but has yet to be released. |
Released in |
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Labels
Current behavior:
cy.get(element).screenshot()
displays a very confusing error if the element has zero height.The code that is causing the confusing error
numScreenshots
ends up being zero whenelPosition.height
is zero.cypress/packages/driver/src/cy/commands/screenshot.coffee
Line 138 in c096251
This causes
_.last(results)
to returnundefined
.cypress/packages/driver/src/cy/commands/screenshot.coffee
Line 99 in c096251
Which causes
takeScreenshot().then()
to receive an undefinedprops
parameter that it cannot destructure with{ duration, path, size } = props;
.cypress/packages/driver/src/cy/commands/screenshot.coffee
Line 357 in c096251
Desired behavior:
cy.get(element).screenshot()
should report an error that the element has zero height.It is also extremely difficult to troubleshoot an error like this because bluebirdjs doesn't automatically log exceptions, so I have no idea where the code in the error message existed.
It appears that bluebirdjs has events for unhandled errors. It would be great if Cypress provided a filename and line number of the where the error is occurring in the Cypress log as well as a stack trace in the browser console.
http://bluebirdjs.com/docs/api/error-management-configuration.html
Steps to reproduce: (app code and test code)
You can recreate the confusing error message by trying to take a screenshot of a
span
with zero height.Versions
Cypress 3.4.1
Ubuntu 16.04 & 18.04
The text was updated successfully, but these errors were encountered: