Reputation: 8214
I have the following rspec test which works fine in the default Selenium driver but it fails in the Capybara Webkit driver.
When the Sign Up button is clicked it verifies the credit card is valid using the payment gateway and before sending the form to the server. It seems like it is not sending the ajax request to the payment gateway in the headless mode. How could I fix this for the webkit driver as I know the code is correct as the same test passes in Selenium.
it "Subscribe to Plan", js: true do
visit subscription_plans_path
fill_in "user_email", :with => subscription_user_email
fill_in "user_password", :with => "password"
fill_in "Name", :with => "John Doe"
fill_in "new_credit_card_field", :with => "4242424242424242"
fill_in "security_code", :with => "123"
select (Time.zone.now.year + 1), :from => "date_year"
click_button "Sign up"
page.should have_content('Dashboard')
end
Upvotes: 1
Views: 527
Reputation: 88
Your best option is to use Selenium drivers instead of using Webkit driver for javascript related tests.
Upvotes: 1