-
Notifications
You must be signed in to change notification settings - Fork 3.1k
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
not.be.visible
assertion fails when element does not exist in DOM and Stripe JS SDK is imported
#5270
Comments
I was able to reproduce this in 3.8.1. Code to reproduce below:
<!DOCTYPE html>
<head>
<script src="https://js.stripe.com/v3"></script>
</head>
<body>
</body>
</html>
<!DOCTYPE html>
<head>
</head>
<body>
</body>
</html>
it('without stripe asserting "not visible"', () => {
cy.visit('without_stripe.html')
cy.get('.foo').should('not.be.visible') // passes
})
it('with stripe asserting "not visible"', () => {
cy.visit('with_stripe.html')
cy.get('.foo').should('not.be.visible') // falsely fails because can't find element
})
it('with stripe asserting "not exists" then "not visible"', () => {
cy.visit('with_stripe.html')
cy.get('.foo')
.should('not.exist')
.and('not.be.visible') // passes
}) Stripe injects an iframe into the html, which may have something to do with it, but I tried injecting a simple iframe into the html and it did not fail like with the Stripe script. |
The code for this is done in cypress-io/cypress#6344, but has yet to be released. |
Released in This comment thread has been locked. If you are still experiencing this issue after upgrading to |
Current behavior:
Normally when asserting that an element is not visible (using
.should('not.be.visible')
), if the element does not exist in the DOM, the assertion passes.For some reason, simply by including the Stripe JS SDK in the head of the document (following the instructions here), the
not.be.visible
assertion fails (by timing out when retrying to find the element) when the element is not in the DOM.There is a work around by checking
not.exist
beforenot.be.visible
Desired behavior:
The behavior should be consistent whether or not the Stripe SDK is imported
Steps to reproduce: (app code and test code)
Repro can be found in this repo
Versions
Cypress 3.4.1
The text was updated successfully, but these errors were encountered: