1 require 'integration_helper'
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.
8 # Command to run diagnostics tests:
9 # RAILS_ENV=diagnostics bundle exec rake TEST=test/diagnostics/**/*.rb
11 class DiagnosticsTest < ActionDispatch::IntegrationTest
13 # Prepends workbench URL to the path provided and visits that page
14 # Expects path parameters such as "/collections/<uuid>"
15 def visit_page_with_token token_name, path='/'
16 workbench_url = Rails.configuration.arvados_workbench_url
17 if workbench_url.end_with? '/'
18 workbench_url = workbench_url[0, workbench_url.size-1]
20 tokens = Rails.configuration.user_tokens
21 visit page_with_token(tokens[token_name], (workbench_url + path))
24 # Looks for the text_to_look_for for up to the max_time provided
25 def wait_until_page_has text_to_look_for, max_time=30
26 max_time = 30 if (!max_time || (max_time.to_s != max_time.to_i.to_s))
28 Timeout.timeout(max_time) do
30 visit_page_with_token 'active', current_path
31 text_found = has_text?(text_to_look_for)