cypress: Cypress test runner crashing on clicking make payment using Stripe payment gateway
Current behavior
After entering the testing card details like card number, cvc and expire date in Stripe Gateway… on clicking make button, cypress test runner is crashing without giving any error or warning message.
Manually Stripe payment is working fine with same card details.

Desired behavior
Test runner should not be crash and in case of some major error - error should be shown there.
Test code to reproduce
cy.get('iframe').its('0.contentDocument.body').should('not.be.empty')
.then(cy.wrap).find('input[name="number"]').type(this.data.PaymentDetails.CardNumber)
cy.get('iframe').its('0.contentDocument.body').should('not.be.empty')
.then(cy.wrap).find('input[name="expiry"]').type(this.data.PaymentDetails.ExpMonthYear)
cy.get('iframe').its('0.contentDocument.body').should('not.be.empty')
.then(cy.wrap).find('input[name="cvc"]').type(this.data.PaymentDetails.Csv)
cy.wait(5000)
cy.get(".confirm-btn >button[id='c-submit-me']").click() // Clicking on this, test runner is crashing.
Cypress Version
10.7.0
Node version
16.14.2
Operating System
Windows 10 Enterprise - OS build - 19044.1889
Debug Logs
Crashed... no logs generated.
Other
No response
About this issue
- Original URL
- State: open
- Created 2 years ago
- Reactions: 1
- Comments: 31 (13 by maintainers)
@amar0120, it appears Stripe is attempting to change the top url which is causing Cypress to go back to the spec list. I initially thought setting experimentalModifyObstructiveThirdPartyCode would resolve the issue but it did not. We will need to investigate that further.
However, in the meantime, I was able to get the test to successfully run using the following intercepts:
No update right now, I spent a few hours playing around with Stripe quickstart but I can’t select the elements with Cypress - I’m not sure if I’m missing something, but it looks like Stripe makes it quite tricky for automation tools to interact with it.
@MehdiSv, thanks for clearing that up for me 😄. I’m not sure why the intercepts wouldn’t run when you are in headless mode. If you are able to create a sample repo I’d be happy to look at it though.
Thanks for the update @MehdiSv, I’ll try to take a look at this later today.