Merge branch 'master' into 2761-diagnostic-suite
[arvados.git] / apps / workbench / test / diagnostics_test_helper.rb
1 require 'integration_helper'
2 require 'yaml'
3
4 # Diagnostics tests are executed when "RAILS_ENV=diagnostics" is used.
5 # When "RAILS_ENV=test" is used, tests in the "diagnostics" directory
6 # will not be executed.
7
8 class DiagnosticsTest < ActionDispatch::IntegrationTest
9
10   def visit_page_with_token token_name, path='/'
11     workbench_url = Rails.configuration.arvados_workbench_url
12     if workbench_url.end_with? '/'
13       workbench_url = workbench_url[0, workbench_url.size-1]
14     end
15     tokens = Rails.configuration.user_tokens
16     visit page_with_token(tokens[token_name], (workbench_url + path))
17   end
18
19   def wait_until_page_has text_to_look_for, max_time=30
20     max_time = 30 if (!max_time || (max_time.to_s != max_time.to_i.to_s))
21     Timeout.timeout(max_time) do
22       loop until page.has_text?(text_to_look_for)
23     end
24   end
25
26 end