Testing Stripe checkout using Cypress

Viewed 557

Is there any way to test stripe checkout (since it is redirecting to stripe checkout page) I got the following code:

cy.intercept(
        'GET',
        'https://checkout.stripe.com/pay',

        {
            statusCode: 200,
            body: {
                message: 'Request successful',
                result: ['my-data']
            },
        }
    ).as('getSession')
cy.get('#checkout-btn').click()
cy.wait('@getSession').then((interception) => console.log(interception))

I can see, that it is printing the interception in the console, but immediately after that, it's redirecting to a new page, where I can see the body. How should I stop that redirection so I can somehow get a successful test?

0 Answers
Related