Merge branch 'master' into 2955-fail-orphan-jobs
[arvados.git] / apps / workbench / test / integration / pipeline_instances_test.rb
1 require 'integration_helper'
2 require 'selenium-webdriver'
3 require 'headless'
4
5 class PipelineInstancesTest < ActionDispatch::IntegrationTest
6   setup do
7     # Selecting collections requiresLocalStorage
8     headless = Headless.new
9     headless.start
10     Capybara.current_driver = :selenium
11   end
12
13   test 'Create and run a pipeline' do
14     visit page_with_token('active_trustedclient')
15
16     click_link 'Pipeline templates'
17     within('tr', text: 'Two Part Pipeline Template') do
18       find('a,button', text: 'Run').click
19     end
20
21     instance_page = current_path
22
23     # Go over to the collections page and select something
24     click_link 'Collections (data files)'
25     within('tr', text: 'GNU_General_Public_License') do
26       find('input[type=checkbox]').click
27     end
28     find('#persistent-selection-count').click
29
30     # Go back to the pipeline instance page to use the new selection
31     visit instance_page
32
33     page.assert_selector 'a.disabled,button.disabled', text: 'Run'
34     assert find('p', text: 'Provide a value')
35
36     find('div.form-group', text: 'Foo/bar pair').
37       find('a,input').
38       click
39     find('.editable-input select').click
40     find('.editable-input').
41       first(:option, 'b519d9cb706a29fc7ea24dbea2f05851+249025').click
42     wait_for_ajax
43
44     # "Run" button is now enabled
45     page.assert_no_selector 'a.disabled,button.disabled', text: 'Run'
46
47     first('a,button', text: 'Run').click
48
49     # Pipeline is running. We have a "Stop" button instead now.
50     page.assert_selector 'a,button', text: 'Stop'
51     find('a,button', text: 'Stop').click
52
53     # Pipeline is stopped. We have the option to resume it.
54     page.assert_selector 'a,button', text: 'Run'
55
56     # Go over to the graph tab
57     click_link 'Graph'
58     assert page.has_css? 'div#provenance_graph'
59   end
60 end