问题
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?
回答1:
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.
来源:https://stackoverflow.com/questions/59667218/how-to-handle-elements-on-paypal-popup-with-cypress-io