7

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?

Mariano Jover
  • 129
  • 1
  • 7

1 Answers1

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.

Audwin Oyong
  • 2,247
  • 3
  • 15
  • 32
Mikkel
  • 7,693
  • 3
  • 17
  • 31
  • At first glance I agree. You are not testing paypal. If you there is a risk of this not working I say figure something else out. – Maccurt Jan 10 '20 at 15:57
  • 8
    Yes, you are right. I am not testing paypal and I am conscious of that. But, as I said before, I am need to automate an e2e test that interacts with paypal to reach a pos sales page where the test need to assert. So that I am trying to workaround this. On the other hand It would be good to be able to test integration with paypal as third party. – Mariano Jover Jan 13 '20 at 10:05
  • 1
    When testing a payment workflow it might contain paypal as well. Therefore you can use a paypal sandbox. I am struggeling at the moment with the paypal login - error log tells me, I am missing the CSRF token. – SoS Oct 01 '21 at 09:50