Closed fdocr closed 6 years ago
A kind fellow from teamcapybara pointed me in the right direction: PayPal increased the minimum TLS version required to connect (v1.2), therefore the need to init the poltergeist driver with a specific flag.
Also added some extra wait times because the PayPal sandbox response times are not great.
The scope of this PR is complete, the following was achieved:
travis_retry
will help for this situation.Appraisals
travis.yml
updated
What’s missing/good things to have (outside the scope of this PR):
Hello @fdoxyz , thanks for your contribution. We're reviewing it at the moment and we definitely want to merge it! We really appreciate your help and we'll get back to you soon
Hi @bbonislawski, of course let me know of any changes you may consider suitable.
I actually found a tiny fix I can make to the PR. I'll push this after I hear back from you, in case any other changes are requested.
Thank you and the rest of the Spree team for everything, glad to help.
I took a deeper look into the tests and started removing some of the
PENDING: Temporarily skipped with xit
. I guess the Spree checkout flow has changed over time, so I added a couple of tweaks.I'm facing a problem though, I believe the poltergeist driver is not redirecting to PayPal as it should. This first commit includes debug commands (
binding.pry
&save_and_open_screenshot
) so it's easier to catch up on the problem.I caught the spec execution with
binding.pry
and manually browsed the server spawned by RSpec that Capybara uses to run the tests (dynamic port assigned on each execution, gotta look it up from the terminal). By doing this I was able to go through the entire process and click the "PayPal Checkout" button in my browser. This means the project works fine, but the tests are not able to validate this.The spec fails after the third breakpoint (line 82) on
paypal_spec.rb
, my comments provide some extra context throughout. It fails because the browser should be in the PayPal checkout page, but thefind("#paypal_button").click
failed to take us there.Doing some debugging I can stop the spec on line 78 and figure out the following values:
This means that
find("#paypal_button")
is indeed the "PayPal Checkout" button and we attempt to click it (line 79), but it does nothing. I see the following output from the terminal though:I have no idea why the request was sent to
https://api-3t.sandbox.paypal.com/2.0/
as seen on the last screenshot. I also ran out of ideas on how to get Capybara/Poltergeist to head over to the PayPal checkout page. That's why I'm asking for help/suggestions :)P.S. I'm running that one check inside the spec for speed/comfort using
bundle exec rake spec SPEC_OPTS="-e \"pays for an order successfully\""
in case it comes in handy for anyone that might want to try it out.