Cypress vanishes when redirecting to site that breaks out of iframe
See original GitHub issue- Operating System: Windows 10
- Cypress Version: 2.1.0
- Browser Version: Chrome 65.0.3325.181 (Official Build) (64-bit)
Is this a Feature or Bug?
Bug or potentially a feature request
Current behavior:
We integrate with Paypal as part of our checkout journey. We need to be able to redirect from our site to Paypal, enter some test credentials, and verify that we get redirected back to the payment complete page on our site. However, when we reach Paypal, they have some code that breaks their page out of the iframe, and Cypress vanishes altogether and the tests stop.
Desired behavior:
Paypal should not be able to break out of the iframe and the tests should continue to run
How to reproduce:
Clone this repo (the smallest I could get it): https://github.com/jpreecedev/cypress-paypal-scratch
run yarn install
then yarn start
and yarn test
in seperate command windows.
Test code:
describe('Kitchen Sink', function() {
it('.should() - assert that <title> is correct', function() {
// https://on.cypress.io/visit
cy.visit('http://localhost:8080/')
cy.get('button').click()
})
})
Additional Info (images, stack traces, etc)
In this repo I don’t redirect to Paypal but another page hosted on my server that basically does the same thing, The file is in the repo and is called breakout.html
. Here is the code
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta http-equiv="X-UA-Compatible" content="ie=edge">
<title>Document</title>
</head>
<body>
<script>
debugger
if (top.location != self.location) {
top.location = self.location.href;
}
</script>
</body>
</html>
Issue Analytics
- State:
- Created 5 years ago
- Reactions:8
- Comments:19 (2 by maintainers)
Top GitHub Comments
@brian-mann
I want to chime in saying that this would be useful. If we’re making a truly E2E test, then checking out via PayPal/Stripe or doing other things on a 3rd party site may be a critical step in the process. At least with Stripe, they provide a dedicated test sandbox specifically designed for this sort of thing so the points about being blocked due to detected automated activity are not always valid.
I was using webdriverio before, and had a truly E2E test including the checkout with stripe. Sad to see that this isn’t possible with Cypress? Is there no way around it?
Three years later I am here, migrating my webdriver tests to cypress and figuring out, that I can’t simulate a checkout with paypal due to the design of cypress? Come on, I am not testing the paypal page, I am testing our checkout-flow. If I can’t test the most critical function of a webshop, what else should I use cypress for? It should be my decision if my tests depend on an external page, but blocking it by default does not sound right to me.