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("#projects-menu").click
42 find('.dropdown-menu a,button', text: 'A Project').click
43 find('.btn', text: 'Add data').click
44 within('.modal-dialog') do
46 first('span', text: 'foo_tag').click
47 find('.btn', text: 'Add').click
49 using_wait_time(Capybara.default_wait_time * 3) do
53 click_link 'Jobs and pipelines'
54 find('tr[data-kind="arvados#pipelineInstance"]', text: '(none)').
55 find('a', text: 'Show').
58 assert find('p', text: 'Provide a value')
60 find('div.form-group', text: 'Foo/bar pair').
61 find('.btn', text: 'Choose').
64 within('.modal-dialog') do
65 assert(has_text?("Foo/bar pair"),
66 "pipeline input picker missing name of input")
68 first('span', text: 'foo_tag').click
69 find('button', text: 'OK').click
73 # "Run" button is now enabled
74 page.assert_no_selector 'a.disabled,button.disabled', text: 'Run'
76 first('a,button', text: 'Run').click
78 # Pipeline is running. We have a "Pause" button instead now.
79 page.assert_selector 'a,button', text: 'Pause'
80 find('a,button', text: 'Pause').click
82 # Pipeline is stopped. It should now be in paused state and Runnable again.
83 assert page.has_text? 'Paused'
84 page.assert_no_selector 'a.disabled,button.disabled', text: 'Resume'
85 page.assert_selector 'a,button', text: 'Re-run with latest'
87 # Since it is test env, no jobs are created to run. So, graph not visible
88 assert_not page.has_text? 'Graph'
91 # Create a pipeline instance from within a project and run
92 test 'Create pipeline inside a project and run' do
93 visit page_with_token('active_trustedclient')
95 # Go over to the collections page and select something
97 within('tr', text: 'GNU_General_Public_License') do
98 find('input[type=checkbox]').click
100 find('#persistent-selection-count').click
102 # Add this collection to the project using collections menu from top nav
104 find("#projects-menu").click
105 find('.dropdown-menu a,button', text: 'A Project').click
106 find('.btn', text: 'Add data').click
107 within('.modal-dialog') do
109 first('span', text: 'foo_tag').click
110 find('.btn', text: 'Add').click
112 using_wait_time(Capybara.default_wait_time * 3) do
116 create_and_run_pipeline_in_aproject false
119 # Create a pipeline instance from within a project and run
120 test 'Run a pipeline from dashboard' do
121 visit page_with_token('active_trustedclient')
122 create_and_run_pipeline_in_aproject true
125 # Create and run a pipeline for 'Two Part Pipeline Template' in 'A Project'
126 def create_and_run_pipeline_in_aproject choose_project
127 # create a pipeline instance
128 find('.btn', text: 'Run a pipeline').click
129 within('.modal-dialog') do
130 find('.selectable', text: 'Two Part Pipeline Template').click
131 find('.btn', text: 'Next: choose inputs').click
134 assert find('p', text: 'Provide a value')
136 find('div.form-group', text: 'Foo/bar pair').
137 find('.btn', text: 'Choose').
140 within('.modal-dialog') do
142 assert_selector 'button.dropdown-toggle', text: 'Home'
145 click_link "A Project"
148 assert_selector 'button.dropdown-toggle', text: 'A Project'
151 first('span', text: 'foo_tag').click
152 find('button', text: 'OK').click
156 # "Run" button present and enabled
157 page.assert_no_selector 'a.disabled,button.disabled', text: 'Run'
158 first('a,button', text: 'Run').click
160 # Pipeline is running. We have a "Pause" button instead now.
161 page.assert_no_selector 'a,button', text: 'Run'
162 page.assert_selector 'a,button', text: 'Pause'
164 # Since it is test env, no jobs are created to run. So, graph not visible
165 assert_not page.has_text? 'Graph'
168 test 'view pipeline with job and see graph' do
169 visit page_with_token('active_trustedclient')
171 visit '/pipeline_instances'
172 assert page.has_text? 'pipeline_with_job'
174 find('a', text: 'pipeline_with_job').click
176 # since the pipeline component has a job, expect to see the graph
177 assert page.has_text? 'Graph'
179 assert page.has_text? 'script_version'
182 test 'pipeline description' do
183 visit page_with_token('active_trustedclient')
185 visit '/pipeline_instances'
186 assert page.has_text? 'pipeline_with_job'
188 find('a', text: 'pipeline_with_job').click
190 within('.arv-description-as-subtitle') do
191 find('.fa-pencil').click
192 find('.editable-input textarea').set('*Textile description for pipeline instance*')
193 find('.editable-submit').click
198 assert page.has_no_text? '*Textile description for pipeline instance*'
199 assert page.has_text? 'Textile description for pipeline instance'
202 test "JSON popup available for strange components" do
203 uuid = api_fixture("pipeline_instances")["components_is_jobspec"]["uuid"]
204 visit page_with_token("active", "/pipeline_instances/#{uuid}")
205 click_on "Components"
206 assert(page.has_no_text?("script_parameters"),
207 "components JSON visible without popup")
208 click_on "Show components JSON"
209 assert(page.has_text?("script_parameters"),
210 "components JSON not found")
213 PROJECT_WITH_SEARCH_COLLECTION = "A Subproject"
214 def check_parameter_search(proj_name)
215 template = api_fixture("pipeline_templates")["parameter_with_search"]
216 search_text = template["components"]["with-search"]["script_parameters"]["input"]["search_for"]
217 visit page_with_token("active", "/pipeline_templates/#{template['uuid']}")
218 click_on "Run this pipeline"
219 within(".modal-dialog") do # Set project for the new pipeline instance
220 find(".selectable", text: proj_name).click
223 assert(has_text?("This pipeline was created from the template"), "did not land on pipeline instance page")
224 first("a.btn,button", text: "Choose").click
225 within(".modal-body") do
226 if (proj_name != PROJECT_WITH_SEARCH_COLLECTION)
227 # Switch finder modal to Subproject to find the Collection.
229 click_on PROJECT_WITH_SEARCH_COLLECTION
231 assert_equal(search_text, first("input").value,
232 "parameter search not preseeded")
233 assert(has_text?(api_fixture("collections")["baz_collection_name_in_asubproject"]["name"]),
234 "baz Collection not in preseeded search results")
238 test "Workbench respects search_for parameter in templates" do
239 check_parameter_search(PROJECT_WITH_SEARCH_COLLECTION)
242 test "Workbench preserves search_for parameter after project switch" do
243 check_parameter_search("A Project")