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}\"]"