9319: show all pipeline_instances, jobs, and container_requests in all_processes...
[arvados.git] / apps / workbench / test / integration / all_processes_test.rb
1 require 'integration_helper'
2
3 class AllProcessesTest < ActionDispatch::IntegrationTest
4   setup do
5     need_javascript
6   end
7
8   [
9     [nil, 25, 100,
10       ['/pipeline_instances/zzzzz-d1hrv-1yfj61234abcdk3',
11        '/pipeline_instances/zzzzz-d1hrv-jobspeccomponts',
12        '/jobs/zzzzz-8i9sb-grx15v5mjnsyxk7',
13        '/jobs/zzzzz-8i9sb-n7omg50bvt0m1nf',
14        '/container_requests/zzzzz-xvhdp-cr4completedcr2',
15        '/container_requests/zzzzz-xvhdp-cr4requestercn2'],
16       ['/pipeline_instances/zzzzz-d1hrv-scarxiyajtshq3l',
17        '/container_requests/zzzzz-xvhdp-oneof60crs00001']],
18     ['foo', 10, 25,
19       ['/pipeline_instances/zzzzz-d1hrv-1xfj6xkicf2muk2',
20        '/pipeline_instances/zzzzz-d1hrv-jobspeccomponts',
21        '/jobs/zzzzz-8i9sb-grx15v5mjnsyxk7'],
22       ['/pipeline_instances/zzzzz-d1hrv-1yfj61234abcdk3',
23        '/jobs/zzzzz-8i9sb-n7omg50bvt0m1nf',
24        '/container_requests/zzzzz-xvhdp-cr4completedcr2']],
25     ['pipeline_with_tagged_collection_input', 1, 1,
26       ['/pipeline_instances/zzzzz-d1hrv-1yfj61234abcdk3'],
27       ['/pipeline_instances/zzzzz-d1hrv-jobspeccomponts',
28        '/jobs/zzzzz-8i9sb-pshmckwoma9plh7',
29        '/jobs/zzzzz-8i9sb-n7omg50bvt0m1nf',
30        '/container_requests/zzzzz-xvhdp-cr4completedcr2']],
31     ['no_such_match', 0, 0,
32       [],
33       ['/pipeline_instances/zzzzz-d1hrv-jobspeccomponts',
34        '/jobs/zzzzz-8i9sb-pshmckwoma9plh7',
35        '/jobs/zzzzz-8i9sb-n7omg50bvt0m1nf',
36        '/container_requests/zzzzz-xvhdp-cr4completedcr2']],
37   ].each do |search_filter, expected_min, expected_max, expected, not_expected|
38     test "scroll all_processes page for search filter '#{search_filter}'" do
39       visit page_with_token('active', "/all_processes")
40
41       if search_filter
42         find('.recent-all-processes-filterable-control').set(search_filter)
43         sleep 1
44         wait_for_ajax
45       end
46
47       page_scrolls = expected_max/20 + 2
48       within('.arv-recent-all-processes') do
49         (0..page_scrolls).each do |i|
50           page.driver.scroll_to 0, 999000
51           begin
52             wait_for_ajax
53           rescue
54           end
55         end
56       end
57
58       # Verify that expected number of processes are found
59       found_items = page.all('tr[data-object-uuid]')
60       found_count = found_items.count
61       if expected_min == expected_max
62         assert_equal(true, found_count == expected_min,
63           "Not found expected number of items. Expected #{expected_min} and found #{found_count}")
64         assert page.has_no_text? 'request failed'
65       else
66         assert_equal(true, found_count>=expected_min,
67           "Found too few items. Expected at least #{expected_min} and found #{found_count}")
68         assert_equal(true, found_count<=expected_max,
69           "Found too many items. Expected at most #{expected_max} and found #{found_count}")
70       end
71
72       # verify that all expected uuid links are found
73       expected.each do |link|
74         assert_selector "a[href=\"#{link}\"]"
75       end
76
77       # verify that none of the not_expected uuid links are found
78       not_expected.each do |link|
79         assert_no_selector "a[href=\"#{link}\"]"
80       end
81     end
82   end
83 end