X-Git-Url: https://git.arvados.org/arvados.git/blobdiff_plain/1060cff7480331bcad2b4564e270922b2b3b1f94..6e066d1a18a699e7abb20dda25670f814e1eb3b3:/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 45398f9096..4885129286 100644 --- a/apps/workbench/test/integration/websockets_test.rb +++ b/apps/workbench/test/integration/websockets_test.rb @@ -65,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)" @@ -158,6 +159,10 @@ class WebsocketTest < ActionDispatch::IntegrationTest visit page_with_token "admin", "/jobs/#{uuid}" click_link "Log" + # Until graphable data arrives, we should see the text log but not the graph. + assert_selector '#event_log_div', visible: true + assert_no_selector '#log_graph_div', visible: true + api = ArvadosApiClient.new # should give 45.3% or (((36.39+0.86)/10.0002)/8)*100 rounded to 1 decimal place @@ -168,9 +173,15 @@ class WebsocketTest < ActionDispatch::IntegrationTest object_uuid: uuid, event_type: "stderr", properties: {"text" => text}}}) - wait_for_ajax - # 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 + # Log div should appear when the first data point arrives by websocket. + assert_selector '#log_graph_div', visible: true + + # 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)