1 require 'integration_helper'
3 class WorkUnitsTest < ActionDispatch::IntegrationTest
8 test "scroll all_processes page" do
9 expected_min, expected_max, expected, not_expected = [
11 ['/pipeline_instances/zzzzz-d1hrv-1yfj61234abcdk3',
12 '/pipeline_instances/zzzzz-d1hrv-jobspeccomponts',
13 '/jobs/zzzzz-8i9sb-grx15v5mjnsyxk7',
14 '/jobs/zzzzz-8i9sb-n7omg50bvt0m1nf',
15 '/container_requests/zzzzz-xvhdp-cr4completedcr2',
16 '/container_requests/zzzzz-xvhdp-cr4requestercn2'],
17 ['/pipeline_instances/zzzzz-d1hrv-scarxiyajtshq3l',
18 '/container_requests/zzzzz-xvhdp-oneof60crs00001']
21 visit page_with_token('active', "/all_processes")
23 page_scrolls = expected_max/20 + 2
24 within('.arv-recent-all-processes') do
25 (0..page_scrolls).each do |i|
26 page.driver.scroll_to 0, 999000
34 # Verify that expected number of processes are found
35 found_items = page.all('tr[data-object-uuid]')
36 found_count = found_items.count
37 if expected_min == expected_max
38 assert_equal(true, found_count == expected_min,
39 "Not found expected number of items. Expected #{expected_min} and found #{found_count}")
40 assert page.has_no_text? 'request failed'
42 assert_equal(true, found_count>=expected_min,
43 "Found too few items. Expected at least #{expected_min} and found #{found_count}")
44 assert_equal(true, found_count<=expected_max,
45 "Found too many items. Expected at most #{expected_max} and found #{found_count}")
48 # verify that all expected uuid links are found
49 expected.each do |link|
50 assert_selector "a[href=\"#{link}\"]"
53 # verify that none of the not_expected uuid links are found
54 not_expected.each do |link|
55 assert_no_selector "a[href=\"#{link}\"]"
60 ['jobs', 'running_job_with_components', true],
61 ['pipeline_instances', 'components_is_jobspec', false],
62 ['containers', 'running', false],
63 ['container_requests', 'running', true],
64 ].each do |type, fixture, cancelable|
65 test "cancel button for #{type}/#{fixture}" do
67 need_selenium 'to cancel'
70 obj = api_fixture(type)[fixture]
71 visit page_with_token "active", "/#{type}/#{obj['uuid']}"
73 assert_text 'created_at'
75 assert_selector 'button', text: 'Cancel'
79 assert_no_selector 'button', text: 'Cancel'
84 ['jobs', 'running_job_with_components'],
85 ['pipeline_instances', 'has_component_with_completed_jobs'],
86 ['container_requests', 'running'],
87 ['container_requests', 'completed'],
88 ].each do |type, fixture|
89 test "edit description for #{type}/#{fixture}" do
90 obj = api_fixture(type)[fixture]
91 visit page_with_token "active", "/#{type}/#{obj['uuid']}"
93 within('.arv-description-as-subtitle') do
94 find('.fa-pencil').click
95 find('.editable-input textarea').set('*Textile description for object*')
96 find('.editable-submit').click
101 assert page.has_no_text? '*Textile description for object*'
102 assert page.has_text? 'Textile description for object'
107 ['Two Part Pipeline Template', 'part-one', 'Provide a value for the following'],
108 ['Workflow with input specifications', 'this workflow has inputs specified', 'Provide a value for the following'],
109 ].each do |template_name, preview_txt, process_txt|
110 test "run a process using template #{template_name} from dashboard" do
111 visit page_with_token('admin')
112 assert_text 'Recent pipelines and processes' # seeing dashboard now
114 within('.recent-processes-actions') do
115 assert page.has_link?('All processes')
116 find('a', text: 'Run a pipeline').click
119 # in the chooser, verify preview and click Next button
120 within('.modal-dialog') do
121 find('.selectable', text: template_name).click
122 assert_text preview_txt
123 find('.btn', text: 'Next: choose inputs').click
126 # in the process page now
127 assert_text process_txt
128 assert_selector 'a', text: template_name