1 require 'diagnostics_test_helper'
2 require 'selenium-webdriver'
5 class PipelineTest < DiagnosticsTest
6 reset_api_fixtures :after_each_test, false
7 reset_api_fixtures :after_suite, false
8 reset_api_fixtures :before_suite, false
10 pipelines_to_test = Rails.configuration.pipelines_to_test.andand.keys
13 headless = Headless.new
15 Capybara.current_driver = :selenium
18 pipelines_to_test.andand.each do |pipeline_to_test|
19 test "visit home page for user #{pipeline_to_test}" do
20 visit_page_with_token 'active'
21 pipeline_config = Rails.configuration.pipelines_to_test[pipeline_to_test]
23 # Search for tutorial template
24 within('.navbar-fixed-top') do
25 page.find_field('search').set pipeline_config['template_uuid']
26 page.find('.glyphicon-search').click
30 find('a,button', text: 'Run').click
33 within('.modal-dialog') do
34 find('.selectable', text: 'Home').click
35 find('button', text: 'Choose').click
38 page.assert_selector('a.disabled,button.disabled', text: 'Run') if pipeline_config['input_paths'].any?
40 # Choose input for the pipeline
41 pipeline_config['input_paths'].each do |look_for|
46 # All needed input are filled in. Run this pipeline now
47 find('a,button', text: 'Run').click
49 # Pipeline is running. We have a "Stop" button instead now.
50 page.assert_selector 'a,button', text: 'Pause'
52 # Wait for pipeline run to complete
53 wait_until_page_has 'Complete', pipeline_config['max_wait_seconds']
57 def select_input look_for
58 inputs_needed = page.all('.btn', text: 'Choose')
59 return if (!inputs_needed || !inputs_needed.any?)
63 if look_for.andand.index('/').andand.>0
64 partitions = look_for.partition('/')
65 look_for_uuid = partitions[0]
66 look_for_file = partitions[2]
68 look_for_uuid = look_for
72 inputs_needed[0].click
74 within('.modal-dialog') do
76 fill_in('Search', with: look_for_uuid, exact: true)
80 page.all('.selectable').first.click
82 # ajax reload is wiping out input selection after search results; so, select again.
83 page.all('.selectable').first.click
88 within('.collection_files_name', text: look_for_file) do
89 find('.fa-file').click
93 find('button', text: 'OK').click