I\'ve hit the wall trying to write an integration test for Stripe\'s checkout.js [ https://checkout.stripe.com/checkout.js ] for my Rails 3.2 app.
Stripe checkout wo
Problem solved!
With some help from parov via his similar question & answer [ Poltergeist Stripe checkout.js ] I tracked the problem down to using an old version of Capybara '~>1.1.2' and the subsequent dependency-effect this had on the various javascript testing gems (ie. selenium, capybara-webkit, poltergeist...).
Doing a bundle update of Capybara to 2.3.0, and so bringing poltergeist to 1.5.1, with selenium-webdriver at 2.42.0 and capybara-webkit at 1.1.0, gets (almost) everything working.
For selenium, this method via Capybara trouble filling in JS modal does work:
stripe_iframe = all('iframe[name=stripe_checkout_app]').last
Capybara.within_frame stripe_iframe do
fill_in "email", with: "test-user@example.com"
...
end
However, that does not work in poltergeist or capybara-webkit.
For poltergeist, parov's suggestion works:
stripe = page.driver.window_handles.last
page.within_window stripe do
fill_in "email", with: "test-user@example.com"
...
end
For capybara-webkit I wasn't able to get anything working, though given I had something working with poltergeist I didn't put too much time into finding a capybara-webkit solution.
Comments?