X-Git-Url: https://git.arvados.org/arvados.git/blobdiff_plain/f8991d36180bf9c2c261dee519b0c878306a35d5..26ac1b2f41916d1f4040073a15dfae5f1b294cb5:/apps/workbench/test/integration/websockets_test.rb diff --git a/apps/workbench/test/integration/websockets_test.rb b/apps/workbench/test/integration/websockets_test.rb index 7a8d7742f2..1ae9010983 100644 --- a/apps/workbench/test/integration/websockets_test.rb +++ b/apps/workbench/test/integration/websockets_test.rb @@ -1,13 +1,8 @@ require 'integration_helper' -require 'selenium-webdriver' -require 'headless' class WebsocketTest < ActionDispatch::IntegrationTest - setup do - headless = Headless.new - headless.start - Capybara.current_driver = :selenium + need_selenium "to make websockets work" end test "test page" do @@ -70,7 +65,8 @@ class WebsocketTest < ActionDispatch::IntegrationTest assert_text '1001 hello' # Check that new value of scrollTop is greater than the old one - assert page.evaluate_script("$('#event_log_div').scrollTop()") > old_top + new_top = page.evaluate_script("$('#event_log_div').scrollTop()") + assert_operator new_top, :>, old_top # Now scroll to 30 pixels from the top page.execute_script "$('#event_log_div').scrollTop(30)" @@ -127,13 +123,13 @@ class WebsocketTest < ActionDispatch::IntegrationTest visit(page_with_token("admin", "/jobs/#{p.uuid}")) assert_no_text 'complete' - assert_no_text 'Re-run same version' + assert_no_text 'Re-run job' p.state = "Complete" p.save! assert_text 'complete' - assert_text 'Re-run same version' + assert_text 'Re-run job' Thread.current[:arvados_api_token] = nil end @@ -175,7 +171,8 @@ class WebsocketTest < ActionDispatch::IntegrationTest properties: {"text" => text}}}) wait_for_ajax - cpu_stat = page.evaluate_script("jobGraphData[0]['cpu-1']") + # using datapoint 1 instead of datapoint 0 because there will be a "dummy" datapoint with no actual stats 10 minutes previous to the one we're looking for, for the sake of making the x-axis of the graph show a full 10 minutes of time even though there is only a single real datapoint + cpu_stat = page.evaluate_script("jobGraphData[1]['T1-cpu']") assert_equal 45.3, (cpu_stat.to_f*100).round(1) @@ -188,10 +185,11 @@ class WebsocketTest < ActionDispatch::IntegrationTest visit page_with_token "admin", "/jobs/#{uuid}" click_link "Log" - ApiServerForTests.new.run_rake_task("replay_job_log", "test/job_logs/crunchstatshort.log,#{uuid}") + ApiServerForTests.new.run_rake_task("replay_job_log", "test/job_logs/crunchstatshort.log,1.0,#{uuid}") wait_for_ajax - cpu_stat = page.evaluate_script("jobGraphData[0]['cpu-1']") + # see above comment as to why we use datapoint 1 rather than 0 + cpu_stat = page.evaluate_script("jobGraphData[1]['T1-cpu']") assert_equal 45.3, (cpu_stat.to_f*100).round(1) end