What's a recommended or reliable way to programmatically test a PayPal payment flow that uses the PayPal Smart Payment Button? window.paypal.Buttons()
is loaded from https://www.paypal.com/sdk/js .
Tests are running against PayPal Sandbox.
I tried to end-to-end test the flow in node.js with jest via puppeteer but am not sure this is a good way to test this, considering that the intervals of PayPal may be subject to change.
Furthermore, when trying to automatically log in via puppeteer, PayPal sometimes seems to show the account homepage with the funds.
However, it's supposed to show the payment methods selection view instead after login, with no errors, which could be some bot protection mechanism kicking in or some other non-deterministic smart behavior, rendering the test to unable to proceed.
Operating my UI manually, I did not observe this behavior.