1 require 'integration_helper'
2 require 'selenium-webdriver'
5 class PipelineInstancesTest < ActionDispatch::IntegrationTest
7 # Selecting collections requiresLocalStorage
8 headless = Headless.new
10 Capybara.current_driver = :selenium
13 test 'Create and run a pipeline' do
14 visit page_with_token('active_trustedclient')
16 visit '/pipeline_templates'
17 within('tr', text: 'Two Part Pipeline Template') do
18 find('a,button', text: 'Run').click
22 within('.modal-dialog') do
23 find('.selectable', text: 'A Project').click
24 find('button', text: 'Choose').click
27 # This pipeline needs input. So, Run should be disabled
28 page.assert_selector 'a.disabled,button.disabled', text: 'Run'
30 instance_page = current_path
32 # Go over to the collections page and select something
34 within('tr', text: 'GNU_General_Public_License') do
35 find('input[type=checkbox]').click
37 find('#persistent-selection-count').click
39 # Add this collection to the project
41 find('.arv-project-list a,button', text: 'A Project').click
42 find('.btn', text: 'Add data').click
43 within('.modal-dialog') do
45 first('span', text: 'foo_tag').click
46 find('.btn', text: 'Add').click
48 using_wait_time(Capybara.default_wait_time * 3) do
52 click_link 'Jobs and pipelines'
53 find('tr[data-kind="arvados#pipelineInstance"]', text: '(none)').
54 find('a', text: 'Show').
57 assert find('p', text: 'Provide a value')
59 find('div.form-group', text: 'Foo/bar pair').
60 find('.btn', text: 'Choose').
63 within('.modal-dialog') do
64 assert(has_text?("Foo/bar pair"),
65 "pipeline input picker missing name of input")
67 first('span', text: 'foo_tag').click
68 find('button', text: 'OK').click
72 # "Run" button is now enabled
73 page.assert_no_selector 'a.disabled,button.disabled', text: 'Run'
75 first('a,button', text: 'Run').click
77 # Pipeline is running. We have a "Stop" button instead now.
78 page.assert_selector 'a,button', text: 'Stop'
79 find('a,button', text: 'Stop').click
81 # Pipeline is stopped. It should now be in paused state and Runnable again.
82 assert page.has_text? 'Paused'
83 page.assert_no_selector 'a.disabled,button.disabled', text: 'Resume'
84 page.assert_selector 'a,button', text: 'Clone and edit'
86 # Since it is test env, no jobs are created to run. So, graph not visible
87 assert_not page.has_text? 'Graph'
90 # Create a pipeline instance from within a project and run
91 test 'Create pipeline inside a project and run' do
92 visit page_with_token('active_trustedclient')
94 # Go over to the collections page and select something
96 within('tr', text: 'GNU_General_Public_License') do
97 find('input[type=checkbox]').click
99 find('#persistent-selection-count').click
101 # Add this collection to the project using collections menu from top nav
103 find('.arv-project-list a,button', text: 'A Project').click
105 find('li.selection-menu > a').click
106 click_button 'Copy selections into this project'
108 # create a pipeline instance
109 find('.btn', text: 'Run a pipeline').click
110 within('.modal-dialog') do
111 find('.selectable', text: 'Two Part Pipeline Template').click
112 find('.btn', text: 'Next: choose inputs').click
115 assert find('p', text: 'Provide a value')
117 find('div.form-group', text: 'Foo/bar pair').
118 find('.btn', text: 'Choose').
121 within('.modal-dialog') do
122 assert_selector 'button.dropdown-toggle', text: 'A Project'
124 first('span', text: 'foo_tag').click
125 find('button', text: 'OK').click
129 # "Run" button present and enabled
130 page.assert_no_selector 'a.disabled,button.disabled', text: 'Run'
131 first('a,button', text: 'Run').click
133 # Pipeline is running. We have a "Stop" button instead now.
134 page.assert_no_selector 'a,button', text: 'Run'
135 page.assert_selector 'a,button', text: 'Stop'
137 # Since it is test env, no jobs are created to run. So, graph not visible
138 assert_not page.has_text? 'Graph'
141 test 'view pipeline with job and see graph' do
142 visit page_with_token('active_trustedclient')
144 visit '/pipeline_instances'
145 assert page.has_text? 'pipeline_with_job'
147 find('a', text: 'pipeline_with_job').click
149 # since the pipeline component has a job, expect to see the graph
150 assert page.has_text? 'Graph'
152 assert page.has_text? 'script_version'
155 test "JSON popup available for strange components" do
156 uuid = api_fixture("pipeline_instances")["components_is_jobspec"]["uuid"]
157 visit page_with_token("active", "/pipeline_instances/#{uuid}")
158 click_on "Components"
159 assert(page.has_no_text?("script_parameters"),
160 "components JSON visible without popup")
161 click_on "Show components JSON"
162 assert(page.has_text?("script_parameters"),
163 "components JSON not found")