Trying to implement Stripe into my web application has brought me to a frustrating roadblock. Every attempt to test the "Pay with Card" button seems to be thwarted by an ElementNotFound error thrown by rspec.
Research revealed that the root cause of this issue was due to the default driver, rack_test, lacking Javascript support. To address this, I consulted some documentation at https://github.com/jnicklas/capybara#drivers and included :js => true in one of my RSpec scenarios, along with adding the selenium-webdriver gem to my gemfile.
Unfortunately, these adjustments unveiled a new hurdle. Now, during testing, I receive an error indicating an invalid username/password combination, preventing me from advancing to verify if I can successfully click the elusive button! It appears that Selenium is struggling to recognize or validate my user factory.
Frustrated gesture.
Any guidance on overcoming this would be greatly appreciated.
spec/features/user_upgrade_premium_spec.rb:
require 'rails_helper'
describe "Upgrading from Standard to Premium Plan" do
before do
@user = create(:user)
visit root_path
click_link "Sign In"
fill_in 'Email', with: @user.email
fill_in 'Password', with: @user.password
click_button "Sign In"
expect(page).to have_content "Signed in successfully."
end
scenario "Successful Upgrade", :js => true do
click_link "My Account"
click_link "Upgrade Account"
click_button "Pay with Card"