diff --git a/Gemfile b/Gemfile index 5a4099adf7e..bfe31c6874a 100644 --- a/Gemfile +++ b/Gemfile @@ -95,7 +95,7 @@ group :test do gem 'rcov', '0.9.9' gem 'rspec', '1.3.2' gem 'rspec-rails', '1.3.4' - gem 'selenium-webdriver', '2.25.0' + gem 'selenium-webdriver', '2.26.0' gem 'webrat', '0.7.3' gem 'yard', '0.8.0' if ONE_NINE diff --git a/spec/selenium/announcements_spec.rb b/spec/selenium/announcements_spec.rb index 8b95adab4c9..1bd27bb446e 100644 --- a/spec/selenium/announcements_spec.rb +++ b/spec/selenium/announcements_spec.rb @@ -37,6 +37,7 @@ describe "announcements" do replace_content(f('input[name=title]'), topic_title) type_in_tiny('textarea[name=message]', 'hi, first announcement') f('#require_initial_post').click + wait_for_ajaximations expect_new_page_load { submit_form('.form-actions') } announcement = Announcement.find_by_title(topic_title) announcement[:require_initial_post].should == true diff --git a/spec/selenium/common.rb b/spec/selenium/common.rb index 19603258052..6d626bde933 100644 --- a/spec/selenium/common.rb +++ b/spec/selenium/common.rb @@ -79,32 +79,48 @@ module SeleniumTestsHelperMethods driver = nil - (1..60).each do |times| - env_test_number = ENV['TEST_ENV_NUMBER'] - env_test_number = 1 if ENV['TEST_ENV_NUMBER'].blank? - - begin - #curbs race conditions on selenium grid nodes - - if times == 1 - first_run = true - stagger_threads(first_run) - else - stagger_threads + if File.exist?("/tmp/nightly_build.txt") + [1, 2, 3].each do |times| + begin + driver = Selenium::WebDriver.for( + :remote, + :url => 'http://' + (SELENIUM_CONFIG[:host_and_port] || "localhost:4444") + '/wd/hub', + :desired_capabilities => caps + ) + break + rescue Exception => e + puts "Error attempting to start remote webdriver: #{e}" + raise e if times == 3 end + end + else + (1..60).each do |times| + env_test_number = ENV['TEST_ENV_NUMBER'] + env_test_number = 1 if ENV['TEST_ENV_NUMBER'].blank? - port_num = (4440 + env_test_number.to_i) - puts "Thread #{env_test_number} connecting to hub over port #{port_num}, try ##{times}" - driver = Selenium::WebDriver.for( - :remote, - :url => "http://127.0.0.1:#{port_num}/wd/hub", - :desired_capabilities => caps - ) - break - rescue Exception => e - puts "Thread #{env_test_number}\n try ##{times}\nError attempting to start remote webdriver: #{e}" - sleep 10 - raise e if times == 60 + begin + #curbs race conditions on selenium grid nodes + + if times == 1 + first_run = true + stagger_threads(first_run) + else + stagger_threads + end + + port_num = (4440 + env_test_number.to_i) + puts "Thread #{env_test_number} connecting to hub over port #{port_num}, try ##{times}" + driver = Selenium::WebDriver.for( + :remote, + :url => "http://127.0.0.1:#{port_num}/wd/hub", + :desired_capabilities => caps + ) + break + rescue Exception => e + puts "Thread #{env_test_number}\n try ##{times}\nError attempting to start remote webdriver: #{e}" + sleep 10 + raise e if times == 60 + end end end end diff --git a/spec/selenium/conversations_context_filtering_spec.rb b/spec/selenium/conversations_context_filtering_spec.rb index e9deeabd660..91185fa15a0 100644 --- a/spec/selenium/conversations_context_filtering_spec.rb +++ b/spec/selenium/conversations_context_filtering_spec.rb @@ -81,6 +81,7 @@ describe "conversations context filtering" do end it "should let you filter by a course" do + pending("xvfb issues") new_conversation browse_menu browse("the course", "Everyone") { click "student2" } @@ -161,6 +162,7 @@ describe "conversations context filtering" do end it "should let you filter by a group" do + pending("xvfb issues") new_conversation browse_menu browse("the course", "Everyone") { click "Select All" } diff --git a/spec/selenium/teacher_quizzes_spec.rb b/spec/selenium/teacher_quizzes_spec.rb index 0276c822885..a68c0b93be0 100644 --- a/spec/selenium/teacher_quizzes_spec.rb +++ b/spec/selenium/teacher_quizzes_spec.rb @@ -310,6 +310,7 @@ describe "quizzes" do end it "should mark dropdown questions as answered" do + pending("xvfb issues") @quiz = quiz_with_new_questions do |bank, quiz| aq1 = AssessmentQuestion.create! aq2 = AssessmentQuestion.create! @@ -324,13 +325,15 @@ describe "quizzes" do end take_quiz do - dropdowns = ff('a.ui-selectmenu.question_input') + dropdowns = ffj('a.ui-selectmenu.question_input') dropdowns.size.should == 6 # partially answer each question [dropdowns.first, dropdowns.last].each do |d| d.click + wait_for_ajaximations f('.ui-selectmenu-open li:nth-child(2)').click + wait_for_ajaximations end # not marked as answered ff('#question_list .answered').should be_empty @@ -338,7 +341,9 @@ describe "quizzes" do # fully answer each question dropdowns.each do |d| d.click + wait_for_ajaximations f('.ui-selectmenu-open li:nth-child(2)').click + wait_for_ajaximations end # marked as answer @@ -346,19 +351,21 @@ describe "quizzes" do wait_for_ajaximations driver.find_element(:link, 'Quizzes').click + wait_for_ajaximations + driver.switch_to.alert.accept wait_for_ajaximations get "/courses/#{@course.id}/quizzes/#{@quiz.id}" - driver.find_element(:link, "Resume Quiz").click + f(:link, "Resume Quiz").click + # there's some initial setTimeout stuff that happens, so things won't # be ready right when the page loads keep_trying_until { dropdowns = ff('a.ui-selectmenu.question_input') dropdowns.size.should == 6 + dropdowns.map(&:text).should == %w{orange green east east east east} } - - dropdowns.map(&:text).should == %w{orange green east east east east} ff('#question_list .answered').size.should == 2 end end