1 require 'diagnostics_test_helper'
2 require 'selenium-webdriver'
5 class PipelineTest < DiagnosticsTest
6 pipelines_to_test = Rails.configuration.pipelines_to_test.andand.keys
9 headless = Headless.new
11 Capybara.current_driver = :selenium
14 pipelines_to_test.andand.each do |pipeline_to_test|
15 test "visit home page for user #{pipeline_to_test}" do
16 visit_page_with_token 'active'
17 pipeline_config = Rails.configuration.pipelines_to_test[pipeline_to_test]
19 # Search for tutorial template
20 within('.navbar-fixed-top') do
21 page.find_field('search').set pipeline_config['template_uuid']
22 page.find('.glyphicon-search').click
26 find('a,button', text: 'Run').click
29 within('.modal-dialog') do
30 find('.selectable', text: 'Home').click
31 find('button', text: 'Choose').click
34 page.assert_selector('a.disabled,button.disabled', text: 'Run') if pipeline_config['input_paths'].any?
36 # Choose input for the pipeline
37 pipeline_config['input_paths'].each do |look_for|
42 # All needed input are filled in. Run this pipeline now
43 find('a,button', text: 'Run').click
45 # Pipeline is running. We have a "Stop" button instead now.
46 page.assert_selector 'a,button', text: 'Pause'
48 # Wait for pipeline run to complete
49 wait_until_page_has 'Complete', pipeline_config['max_wait_seconds']
53 def select_input look_for
54 inputs_needed = page.all('.btn', text: 'Choose')
55 return if (!inputs_needed || !inputs_needed.any?)
59 if look_for.andand.index('/').andand.>0
60 partitions = look_for.partition('/')
61 look_for_uuid = partitions[0]
62 look_for_file = partitions[2]
64 look_for_uuid = look_for
68 inputs_needed[0].click
70 within('.modal-dialog') do
72 fill_in('Search', with: look_for_uuid, exact: true)
76 page.all('.selectable').first.click
78 # ajax reload is wiping out input selection after search results; so, select again.
79 page.all('.selectable').first.click
84 within('.collection_files_name', text: look_for_file) do
85 find('.fa-file').click
89 find('button', text: 'OK').click