ruby on rails - Utilizing selenium to test Javascript elements via RSpec causes other parts of the RSpec test to fail -


i attempting integrate stripe web app i'm building. however, ran niggling problem when tried test "pay card" button. whatever seemed do, rspec throw elementnotfound error.

after searching discovered because default driver, rack_test, not support javascript. referred documentation: https://github.com/jnicklas/capybara#drivers , added :js => true 1 of rspec scenarios, selenium-webdriver gem gemfile.

however, has introduced set of problems. whenever run test, i'm told i'm using invalid username/password combination, , can't progress next part of test see whether or not can click damn button! selenium seems not recognizing and/or invalidating user factory.

throws hands.

any appreciated.

spec/features/user_upgrade_premium_spec.rb:

require 'rails_helper'  describe "upgrade standard premium plan"     before      @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 "successfully", :js => true     click_link "my account"     click_link "upgrade account"      click_button "pay card"  end end   

spec/factories/user.rb

factorygirl.define   factory :user     name "user one"     sequence(:email, 100) { |n| "person#{n}@example.com" }     password "helloworld"     password_confirmation "helloworld"     confirmed_at time.now   end end 

try script_timeout under timeouts category such implicit_wait , page_load; declare globally , lets see how works in our case!!

@driver.manage.timeouts.script_timeout = 15 

Comments

Popular posts from this blog

IF statement in MySQL trigger -

c++ - What does MSC in "// appease MSC" comments mean? -

javascript - Blogger related post gadget image Resize s72-c [ Need Expert Help ] -