Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to handle elements on PayPal popup with cypress.io

I need to automate an end to end test that include purchase an order with PayPal. This test includes validate some elements in a screen that appears once the order is purchased. I'm currently trying with cypress.io. I know cypress recommend against visiting 3rd party sites but I need to interact with PayPal in this test. I have not been able to deal with it.

Is there any workaround to interact with the PayPal popup when using cypress.io?

like image 627
Mariano Jover Avatar asked Jan 09 '20 15:01

Mariano Jover


1 Answers

Unless you are testing PayPal itself, you should avoid doing this. Cypress make these recommendations for a reason. You run the risk of mistakenly doing financial transactions, and PayPal won't take kindly to you running your app tests against their live server.

If you really need to test how your app works, you should mock up the PayPal API's, so that you can make sure everything works as expected. This might be quite a bit of work to make it behave properly.

If you want to test out some kind of iframe interactivity with PayPal, it's going to be difficult, as the security layer in the browser is likely to prevent cross-domain activity.

like image 52
Mikkel Avatar answered Nov 04 '22 20:11

Mikkel