#aaditya23-testing-google-pay
1 messages · Page 1 of 1 (latest)
Hi 👋 I'm not familiar with Cypress, is that a browser-driving test framework like Selenium?
Yeah
So basically it spins up a fresh chromium browser and runs all the tests on it.
Gotcha, and if you hit your site normally, does Google Pay render as expected?
it works fine when im running normally
I'm not certain, but my suspicion is that Cypress is starting an incognito session, to avoid cookie/session conflicts, which block chromium from accessing your saved payment methods which blocks Google Pay from displaying.
Yeah. it does something like that. https://docs.cypress.io/guides/guides/launching-browsers#Cypress-Profile
Yeah, that's going to make things tricky. If that profile is persistent then you might be able to save a card to it. If not you'll either need to find a way to allow Cypress to access your saved cards, or, as you mentioned initially, mock the payment request so you can provide a fabricated response.
Okay. So ill figure out how to mock the payment request API then .
What API call can i look for in the Network tab ?
This guide seems to a good job walking through that, specifically for Cypress
https://simonsmith.io/mocking-stripe-js-methods-with-cypress#real-world-example-mocking-the-stripepaymentrequest-api
In this post we will be looking at how to create mock functions for any of the
methods returned by Stripe.js within a Cypress test and also…
I did go through this. I'll it out and see.
Thanks