Not only did scrolling never stopped, it never reloaded the next page and reloaded the same first page again and again.
Added test fixtures with many objects to test scrolling.
Added tests to use vertical scrollbar. The test itself is not able to test infinite scrolling by reloading the next page.
This may be because in integration testing new content is displayed only due to a click action.
attr == 'created_at' and op == nextpage_operator
end
if @objects.any?
+ @offset += @objects.length
@next_page_filters += [['created_at',
nextpage_operator,
@objects.last.created_at]]
@next_page_href = url_for(partial: :contents_rows,
+ offset: @offset,
filters: @next_page_filters.to_json)
else
@next_page_href = nil
end
end
+ [
+ ['project with 10 collections', 10],
+ ['project with 201 collections', 201], # two pages of data
+ ].each do |project_name, amount|
+ test "scroll collections tab for #{project_name} with #{amount} objects" do
+ visit page_with_token 'user1_with_load'
+
+ find("#projects-menu").click
+ find(".dropdown-menu a", text: project_name).click
+
+ my_collections = []
+ for i in 1..amount
+ my_collections << "Collection_#{i}"
+ end
+
+ # verify Data collections scroll
+ assert(page.has_text?("Data collections (#{amount})"), "Number of collections did not match the input amount")
+
+ click_link 'Data collections'
+ begin
+ wait_for_ajax
+ rescue
+ end
+
+ verify_collections = my_collections.dup
+ unexpected_items = []
+ collections_count = 0
+ within('.arv-project-Data_collections') do
+ scrollbar_present = page.execute_script("return document.documentElement.scrollHeight>document.documentElement.clientHeight;");
+ if scrollbar_present
+ page.execute_script "window.scrollBy(0,10000)"
+ begin
+ wait_for_ajax
+ rescue
+ end
+ end
+
+ # Visit all rows. If not all expected collections are found, retry
+ found_collections = page.all('tr[data-kind="arvados#collection"]')
+ collections_count = found_collections.count
+
+ (0..collections_count-1).each do |i|
+ # Found row text would be of the format "Show Collection_#{n} "
+ collection_name = found_collections[i].text.split[1]
+ if !my_collections.include? collection_name
+ unexpected_items << collection_name
+ else
+ verify_collections.delete collection_name
+ end
+ end
+
+ assert_equal true, unexpected_items.empty?, "Found unexpected items #{unexpected_items.inspect}"
+ if amount > 200
+ assert_equal 200, collections_count, "Found different number of collections"
+ assert_equal amount-200, verify_collections.length, "Did not find all the collections"
+ else
+ assert_equal amount, collections_count, "Found different number of collections"
+ assert_equal true, verify_collections.empty?, "Did not find all the collections"
+ end
+ end
+ end
+ end
+
+ [
+ ['project with 10 pipelines', 10, 0],
+ ['project with 20 pipelines and jobs', 20, 20],
+# ['project with 250 pipelines', 250, 0],
+ ].each do |project_name, num_pipelines, num_jobs|
+ test "scroll pipeline instances tab for #{project_name} with #{num_pipelines} pipelines and #{num_jobs} jobs" do
+ visit page_with_token 'user1_with_load'
+
+ find("#projects-menu").click
+ find(".dropdown-menu a", text: project_name).click
+
+ my_pipelines = []
+ (1..num_pipelines).each do |i|
+ name = "pipeline_#{i}"
+ my_pipelines << name
+ end
+
+ # verify Jobs and pipelines tab scroll
+ assert(page.has_text?("Jobs and pipelines (#{num_pipelines+num_jobs})"), "Number of objects did not match the input counts")
+ click_link 'Jobs and pipelines'
+ begin
+ wait_for_ajax
+ rescue
+ end
+
+ verify_pipelines = my_pipelines.dup
+ unexpected_items = []
+ object_count = 0
+ within('.arv-project-Jobs_and_pipelines') do
+ scrollbar_present = page.execute_script("return document.documentElement.scrollHeight>document.documentElement.clientHeight;");
+ if scrollbar_present
+ page.execute_script "window.scrollBy(0,10000)"
+ begin
+ wait_for_ajax
+ rescue
+ end
+ end
+
+ # Visit all rows. Repeat if not all expected my_pipelines are found (inifinite scrolling should kick in)
+ pipelines_found = page.all('tr[data-kind="arvados#pipelineInstance"]')
+ pipeline_count = pipelines_found.count
+ (0..pipeline_count-1).each do |i|
+ name = pipelines_found[i].text.split[1]
+ if !my_pipelines.include? name
+ unexpected_items << name
+ else
+ verify_pipelines.delete name
+ end
+
+ assert_equal true, unexpected_items.empty?, "Found unexpected items #{unexpected_items.inspect}"
+ end
+ assert_equal num_pipelines, pipeline_count, "Found different number of pipelines"
+ assert_equal true, verify_pipelines.empty?, "Did not find all the pipelines"
+
+ jobs_found = page.all('tr[data-kind="arvados#job"]')
+ job_count = jobs_found.count
+ assert_equal num_jobs, job_count, 'Did not find expected number of jobs'
+ end
+ end
+ end
+
end
begin
path = File.join(ApiServerForTests::ARV_API_SERVER_DIR,
'test', 'fixtures', "#{name}.yml")
- YAML.load(IO.read(path))
+ file = IO.read(path)
+ trim_index = file.index('# Test Helper trims the rest of the file')
+ file = file[0, trim_index] if trim_index
+ YAML.load(file)
end
end
end
user: user_foo_in_sharing_group
api_token: 2p1pou8p4ls208mcbedeewlotghppenobcyrmyhq8pyf51xd8u
expires_at: 2038-01-01 00:00:00
+
+user1_with_load:
+ api_client: untrusted
+ user: user1_with_load
+ api_token: 1234k6lzmp9kj5cpkcoxie963cmvjahbt2fod9zru30k1jqdmi
+ expires_at: 2038-01-01 00:00:00
owner_uuid: zzzzz-tpzed-81hsbo6mk8nl05c
created_at: 2014-02-03T17:22:54Z
name: collection_owned_by_foo
+
+# Test Helper trims the rest of the file
+
+# Do not add your fixtures below this line as the rest of this file will be trimmed by test_helper
+
+# collections in project_with_10_collections
+<% for i in 1..10 do %>
+collection_<%=i%>_of_10:
+ name: Collection_<%= i %>
+ portable_data_hash: ea10d51bcf88862dbcc36eb292017dfd+45
+ manifest_text: ". 73feffa4b7f6bb68e44cf984c85f6e88+3 0:3:baz\n"
+ uuid: zzzzz-4zz18-10gneyn6brkx<%= i.to_s.rjust(3, '0') %>
+ owner_uuid: zzzzz-j7d0g-0010collections
+ created_at: <%= 1.minute.ago.to_s(:db) %>
+<% end %>
+
+# collections in project_with_201_collections
+<% for i in 1..201 do %>
+collection_<%=i%>_of_201:
+ name: Collection_<%= i %>
+ portable_data_hash: ea10d51bcf88862dbcc36eb292017dfd+45
+ manifest_text: ". 73feffa4b7f6bb68e44cf984c85f6e88+3 0:3:baz\n"
+ uuid: zzzzz-4zz18-201gneyn6brd<%= i.to_s.rjust(3, '0') %>
+ owner_uuid: zzzzz-j7d0g-0201collections
+ created_at: <%= 1.minute.ago.to_s(:db) %>
+<% end %>
+
+# Do not add your fixtures below this line as the rest of this file will be trimmed by test_helper
name: Active user has can_manage
# Group for testing granting permission between users who share a group.
-#
group_for_sharing_tests:
uuid: zzzzz-j7d0g-t4ucgncwteul7zt
owner_uuid: zzzzz-tpzed-000000000000000
name: Group for sharing tests
description: Users who can share objects with each other
group_class: role
+
+project_with_10_collections:
+ uuid: zzzzz-j7d0g-0010collections
+ owner_uuid: zzzzz-tpzed-user1withloadab
+ created_at: 2014-04-21 15:37:48 -0400
+ modified_by_client_uuid: zzzzz-ozdt8-brczlopd8u8d0jr
+ modified_by_user_uuid: zzzzz-tpzed-user1withloadab
+ modified_at: 2014-04-21 15:37:48 -0400
+ updated_at: 2014-04-21 15:37:48 -0400
+ name: project with 10 collections
+ description: This will result in one page in the display
+ group_class: project
+
+project_with_201_collections:
+ uuid: zzzzz-j7d0g-0201collections
+ owner_uuid: zzzzz-tpzed-user1withloadab
+ created_at: 2014-04-21 15:37:48 -0400
+ modified_by_client_uuid: zzzzz-ozdt8-brczlopd8u8d0jr
+ modified_by_user_uuid: zzzzz-tpzed-user1withloadab
+ modified_at: 2014-04-21 15:37:48 -0400
+ updated_at: 2014-04-21 15:37:48 -0400
+ name: project with 201 collections
+ description: This will result in two pages in the display
+ group_class: project
+
+project_with_10_pipelines:
+ uuid: zzzzz-j7d0g-000010pipelines
+ owner_uuid: zzzzz-tpzed-user1withloadab
+ created_at: 2014-04-21 15:37:48 -0400
+ modified_by_client_uuid: zzzzz-ozdt8-brczlopd8u8d0jr
+ modified_by_user_uuid: zzzzz-tpzed-user1withloadab
+ modified_at: 2014-04-21 15:37:48 -0400
+ updated_at: 2014-04-21 15:37:48 -0400
+ name: project with 10 pipelines
+ description: project with 10 pipelines
+ group_class: project
+
+project_with_20_jobs_and_20_pipelines:
+ uuid: zzzzz-j7d0g-20jobspipelines
+ owner_uuid: zzzzz-tpzed-user1withloadab
+ created_at: 2014-04-21 15:37:48 -0400
+ modified_by_client_uuid: zzzzz-ozdt8-brczlopd8u8d0jr
+ modified_by_user_uuid: zzzzz-tpzed-user1withloadab
+ modified_at: 2014-04-21 15:37:48 -0400
+ updated_at: 2014-04-21 15:37:48 -0400
+ name: project with 20 pipelines and jobs
+ description: This will result in two pages in the display
+ group_class: project
+
+project_with_250_pipelines:
+ uuid: zzzzz-j7d0g-000201pipelines
+ owner_uuid: zzzzz-tpzed-user1withloadab
+ created_at: 2014-04-21 15:37:48 -0400
+ modified_by_client_uuid: zzzzz-ozdt8-brczlopd8u8d0jr
+ modified_by_user_uuid: zzzzz-tpzed-user1withloadab
+ modified_at: 2014-04-21 15:37:48 -0400
+ updated_at: 2014-04-21 15:37:48 -0400
+ name: project with 250 pipelines
+ description: project with 250 pipelines
+ group_class: project
done: 1
runtime_constraints: {}
state: Cancelled
+
+# Test Helper trims the rest of the file
+
+# Do not add your fixtures below this line as the rest of this file will be trimmed by test_helper
+
+# jobs in project_with_20_pipelines_and_20_jobs
+<% for i in 1..20 do %>
+job_<%=i%>_of_20:
+ uuid: zzzzz-8i9sb-0vsrcqi7whch<%= i.to_s.rjust(3, '0') %>
+ created_at: 2014-09-01 12:00:00
+ owner_uuid: zzzzz-j7d0g-20jobspipelines
+ script_version: 7def43a4d3f20789dda4700f703b5514cc3ed250
+ state: Complete
+<% end %>
+
+# Do not add your fixtures below this line as the rest of this file will be trimmed by test_helper
name: can_read
head_uuid: zzzzz-tpzed-n3oaj4sm5fcnwib
+user1-with-load_member_of_all_users_group:
+ uuid: zzzzz-o0j2j-user1-with-load
+ owner_uuid: zzzzz-tpzed-000000000000000
+ created_at: 2014-01-24 20:42:26 -0800
+ modified_by_client_uuid: zzzzz-ozdt8-brczlopd8u8d0jr
+ modified_by_user_uuid: zzzzz-tpzed-d9tiejq69daie8f
+ modified_at: 2014-01-24 20:42:26 -0800
+ updated_at: 2014-01-24 20:42:26 -0800
+ tail_uuid: zzzzz-tpzed-user1withloadab
+ link_class: permission
+ name: can_read
+ head_uuid: zzzzz-j7d0g-fffffffffffffff
+ properties: {}
required: true
dataclass: Collection
title: foo instance input
+
+# Test Helper trims the rest of the file
+
+# Do not add your fixtures below this line as the rest of this file will be trimmed by test_helper
+
+# pipelines in project_with_10_pipelines
+<% for i in 1..10 do %>
+pipeline_<%=i%>_of_10:
+ name: pipeline_<%= i %>
+ state: New
+ uuid: zzzzz-d1hrv-10gneyn6br1x<%= i.to_s.rjust(3, '0') %>
+ owner_uuid: zzzzz-j7d0g-000010pipelines
+ created_at: <%= 1.minute.ago.to_s(:db) %>
+ components:
+ foo:
+ script: foo
+ script_version: master
+ script_parameters:
+ input:
+ required: true
+ dataclass: Collection
+ title: foo instance input
+<% end %>
+
+# pipelines in project_with_20_pipelines_and_20_jobs
+<% for i in 1..20 do %>
+pipeline_<%=i%>_of_20_pipelines_and_20_jobs:
+ name: pipeline_<%= i %>
+ state: New
+ uuid: zzzzz-d1hrv-abcgneyn6brx<%= i.to_s.rjust(3, '0') %>
+ owner_uuid: zzzzz-j7d0g-20jobspipelines
+ created_at: <%= 1.minute.ago.to_s(:db) %>
+ components:
+ foo:
+ script: foo
+ script_version: master
+ script_parameters:
+ input:
+ required: true
+ dataclass: Collection
+ title: foo instance input
+<% end %>
+
+# pipelines in project_with_250_pipelines
+<% for i in 1..250 do %>
+pipeline_<%=i%>_of_250_pipelines:
+ name: pipeline_<%= i %>
+ state: New
+ uuid: zzzzz-d1hrv-250gneyn6brx<%= i.to_s.rjust(3, '0') %>
+ owner_uuid: zzzzz-j7d0g-000250pipelines
+ created_at: <%= 1.minute.ago.to_s(:db) %>
+ components:
+ foo:
+ script: foo
+ script_version: master
+ script_parameters:
+ input:
+ required: true
+ dataclass: Collection
+ title: foo instance input
+<% end %>
+
+# Do not add your fixtures below this line as the rest of this file will be trimmed by test_helper
identity_url: https://user_bar_in_sharing_group.openid.local
is_active: true
is_admin: false
+
+user1_with_load:
+ owner_uuid: zzzzz-tpzed-000000000000000
+ uuid: zzzzz-tpzed-user1withloadab
+ email: user1_with_load@arvados.local
+ first_name: user1_with_load
+ last_name: User
+ identity_url: https://user1_with_load.openid.local
+ is_active: true
+ is_admin: false
+ prefs:
+ profile:
+ organization: example.com
+ role: IT