ruby - Capybara Rspec tests fail unless I use selenium webdriver -
i writing rock paper scissors program course on.
my feature test file follows...
require 'spec_helper' require 'capybara/dsl' require 'selenium-webdriver' require 'tilt/erb' require './lib/computer.rb' feature 'user can play rock, paper, scissors..' let(:computer){double :computer} # before # include capybara::dsl # capybara.default_driver = :selenium # end scenario 'user can enter name' sign_in expect(page).to have_content "player name = reiss" end scenario 'page has buttons allows user select move' sign_in click_button('rock') end scenario 'see move computer played' sign_in click_button("rock") expect(page).to have_content "the computer played" end scenario 'see move computer played' sign_in click_button("paper") expect(page).to have_content "you played paper" end scenario 'player plays rock & either wins or looses' sign_in click_button('rock') expect(page).to have_content "game result:" end scenario 'player plays paper & either wins or looses' sign_in click_button('paper') expect(page).to have_content "game result:" end scenario 'player plays scissors & either wins or looses' sign_in click_button('scissors') expect(page).to have_content "game result:" end scenario 'user can play round if want to' sign_in click_button('scissors') click_button('play again') expect(page).to have_content "player name = reiss" end end
my problem when don't include capybara dsl & default driver loop up-top tests fail. when loop isn't commented out. opens in firefox , runs through tests pass. when doesn't rspec fails test. first error cannot find name on page, rest cannot seem find button on respective page. again, when run selenium fine. wouldn't bothered code being checked travis ci on pull request , therefore isn't passing currently!
could shed light?
Comments
Post a Comment