#asyranok
1 messages · Page 1 of 1 (latest)
👋 Sorry for the delay! Just to be clear, are you building a Stripe App or is your question about UI testing more generally?
My company already uses Stripe for our checkouts, and I am an SDET, writing out tests for their app. But I am blocked on actually entering credit card info due to how the Stripe iframes do not expose their content in the DOM of the browser.
Got it. We don't allow UI testing with tools like Selenium
Why not, out of curiosity? That seems like something an enormous amount of your customer base might rely on? Can you offer any alternatives/workarounds for me to explore? Or should I just explore the image recognition angle?
Hello! I'm taking over and catching up...
The Stripe iframes created by Stripe.js are designed to be secure and resistant to outside interactions, including automated testing. If you want to develop your own automated testing that's fine, but it's not something we can help you with here.
That's a shame, since testing is such a critical part of any software, and automation testing is increasingly critical. We may have to look into different libraries for our checkout logic then. Thanks for your help.
There are usually other ways to test that don't involve modifying the UI.
You can sub in pm_card_visa at the right point, for example.
We have tons of different test Payment Methods to simulate different outcomes.
I will look into this, thanks. As long as I can complete a checkout using the existing form with this Stripe iframe embedded, then actually physically entering the data into the browser isn't necessary. Could I do that by extracting the url of the iframe and then running that shell script shown in the above docs?
No, you wouldn't interact with the iframe at all. Instead of getting the result of interacting with the iframe use one of the test Payment Methods instead.
For example, let's say you wanted to test a generic card decline: https://stripe.com/docs/testing#declined-payments
Switch to the Payment Method tab there.
You can use pm_card_visa_chargeDeclined instead of the pm_••• you would get from putting the 4000000000000002 test card into Stripe Elements without ever interacting with Stripe Elements or the underlying iframes at all.
I see, thanks! So basically we are mocking the response from Stripe in our code, and just performing whatever we do on our end based on those responses?
Exactly, yep!