2872: add test for a pipeline instance with job associated so that the provenance...
[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     visit '/pipeline_templates'
17     within('tr', text: 'Two Part Pipeline Template') do
18       find('a,button', text: 'Run').click
19     end
20
21     # This pipeline needs input. So, Run should be disabled
22     page.assert_selector 'a.disabled,button.disabled', text: 'Run'
23
24     instance_page = current_path
25
26     find('button', text: 'Choose a folder...').click
27     within('.modal-dialog') do
28       find('.selectable', text: 'A Folder').click
29       find('button', text: 'Move').click
30     end
31
32     # Go over to the collections page and select something
33     visit '/collections'
34     within('tr', text: 'GNU_General_Public_License') do
35       find('input[type=checkbox]').click
36     end
37     find('#persistent-selection-count').click
38
39     # Add this collection to the folder
40     visit '/folders'
41     find('.arv-folder-list a,button', text: 'A Folder').click
42     find('.btn', text: 'Add data').click
43     find('span', text: 'foo_tag').click
44     within('.modal-dialog') do
45       find('.btn', text: 'Add').click
46     end
47    
48     find('tr[data-kind="arvados#pipelineInstance"]', text: 'New pipeline instance').
49       find('a', text: 'Show').
50       click
51
52     assert find('p', text: 'Provide a value')
53
54     find('div.form-group', text: 'Foo/bar pair').
55       find('.btn', text: 'Choose').
56       click
57
58     within('.modal-dialog') do
59       find('span', text: 'foo_tag').click
60       find('button', text: 'OK').click
61     end
62
63     wait_for_ajax
64
65     # "Run" button is now enabled
66     page.assert_no_selector 'a.disabled,button.disabled', text: 'Run'
67
68     first('a,button', text: 'Run').click
69
70     # Pipeline is running. We have a "Stop" button instead now.
71     page.assert_selector 'a,button', text: 'Stop'
72     find('a,button', text: 'Stop').click
73
74     # Pipeline is stopped. It should now be in paused state and Runnable again.
75     assert page.has_text? 'Paused'
76     page.assert_no_selector 'a.disabled,button.disabled', text: 'Resume'
77     page.assert_selector 'a,button', text: 'Clone and edit'
78
79     # Since it is test env, no jobs are created to run. So, graph not visible
80     assert_not page.has_text? 'Graph'
81   end
82
83   test 'view pipeline with job and see graph' do
84     visit page_with_token('active_trustedclient')
85
86     visit '/pipeline_instances'
87     assert page.has_text? 'pipeline_with_job'
88
89     find('a', text: 'pipeline_with_job').click
90
91     # since the pipeline component has a job, expect to see the graph
92     assert page.has_text? 'Graph'
93     click_link 'Graph'
94     assert page.has_text? 'script_version'
95   end
96
97 end