From 008cec917d19fadc011fdb1d61d7b54ffe1d4dda Mon Sep 17 00:00:00 2001 From: radhika Date: Fri, 7 Nov 2014 10:12:09 -0500 Subject: [PATCH] 4024: add integration tests for pipeline_instances page infinite scrolling. --- .../pipeline_instances/_show_recent.html.erb | 2 +- .../_show_recent_rows.html.erb | 2 +- .../integration/pipeline_instances_test.rb | 29 +++++++++++++++++++ 3 files changed, 31 insertions(+), 2 deletions(-) diff --git a/apps/workbench/app/views/pipeline_instances/_show_recent.html.erb b/apps/workbench/app/views/pipeline_instances/_show_recent.html.erb index cc4b957d25..288fe1319e 100644 --- a/apps/workbench/app/views/pipeline_instances/_show_recent.html.erb +++ b/apps/workbench/app/views/pipeline_instances/_show_recent.html.erb @@ -1,6 +1,6 @@ <%= form_tag do |f| %> - +
diff --git a/apps/workbench/app/views/pipeline_instances/_show_recent_rows.html.erb b/apps/workbench/app/views/pipeline_instances/_show_recent_rows.html.erb index e8406dc1c7..f369c55c95 100644 --- a/apps/workbench/app/views/pipeline_instances/_show_recent_rows.html.erb +++ b/apps/workbench/app/views/pipeline_instances/_show_recent_rows.html.erb @@ -1,5 +1,5 @@ <% @objects.sort_by { |ob| ob.created_at }.reverse.each do |ob| %> - +
<%= check_box_tag 'uuids[]', ob.uuid, false, :class => 'persistent-selection' %> diff --git a/apps/workbench/test/integration/pipeline_instances_test.rb b/apps/workbench/test/integration/pipeline_instances_test.rb index 7095a87442..3a80220b07 100644 --- a/apps/workbench/test/integration/pipeline_instances_test.rb +++ b/apps/workbench/test/integration/pipeline_instances_test.rb @@ -364,4 +364,33 @@ class PipelineInstancesTest < ActionDispatch::IntegrationTest "Time difference did not match for start_at #{start_at}, finished_at #{finished_at}, ran_for #{match[2]}") end end + + [ + ['fuse', 2, 20], # has 2 pipeline instances on 11-07-2014 + ['user1_with_load', 30, 100], # has 37 pipeline instances on 11-07-2014 + ].each do |user, expected_min, expected_max| + test "scroll pipeline instances page for #{user} and expect more than #{expected_min} and less than #{expected_max}" do + visit page_with_token(user, "/pipeline_instances") + + num_pages = expected_max/20 + 1 # pipeline_instances page uses 20 for page size + within('.arv-recent-pipeline-instances') do + (0..num_pages).each do |i| + page.execute_script "window.scrollBy(0,999000)" + begin + wait_for_ajax + rescue + end + end + end + + # Visit all rows and verify that expected number of pipeline instances are found + found_items = page.all('tr[data-kind="arvados#pipelineInstance"]') + found_count = found_items.count + assert_equal(true, found_count>=expected_min, + "Found too few items. Expected at least #{expected_min} and found #{found_count}") + assert_equal(true, found_count<=expected_max, + "Found too many items. Expected at most #{expected_max} and found #{found_count}") + end + end + end -- 2.30.2