4024: a few more test cases for search filter in pipeline instances page.
[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   # Prepends workbench URL to the path provided and visits that page
11   # Expects path parameters such as "/collections/<uuid>"
12   def visit_page_with_token token_name, path='/'
13     workbench_url = Rails.configuration.arvados_workbench_url
14     if workbench_url.end_with? '/'
15       workbench_url = workbench_url[0, workbench_url.size-1]
16     end
17     tokens = Rails.configuration.user_tokens
18     visit page_with_token(tokens[token_name], (workbench_url + path))
19   end
20
21   # Looks for the text_to_look_for for up to the max_time provided
22   def wait_until_page_has text_to_look_for, max_time=30
23     max_time = 30 if (!max_time || (max_time.to_s != max_time.to_i.to_s))
24     Timeout.timeout(max_time) do
25       loop until page.has_text?(text_to_look_for)
26     end
27   end
28
29 end