I've been using Selenium-Webdriver as the javascript driver for running Cucumber tests on my Rails app and had consistent results. Recently, I decided to switch to Poltergeist to run headless.
Some of my tests involve a Stripe transaction that triggers a javascript popup. Here are the steps I have:
When(/^I wait to see "([^"]*)" in a Stripe popup$/) do |arg1|
within_frame 'stripe_checkout_app' do
wait_until do
expect(page).to have_content(arg1)
end
end
end
These steps worked flawlessly when I was using selenium as my Capybara javascript driver, but they fail with :poltergeist
. Error messages like this one pop up:
Unsafe JavaScript attempt to access frame with URL http://127.0.0.1:64780/charges/1/edit from frame with URL https://checkout.stripe.com/v3/VguVZoYKogJUsO05PpIlfA.html?distinct_id=ad0ab5bb-c346-dac7-62dc-2a4a8e4dcf64. Domains, protocols and ports must match.
Why would these errors occur with poltergeist
, but not with selenium-webdriver
? Any insights?