[ARVADOS] updated: 61f351e9e3542308fe0a41fa7f41e4de85130c24
git at public.curoverse.com
git at public.curoverse.com
Thu Oct 16 11:03:13 EDT 2014
Summary of changes:
.../app/controllers/projects_controller.rb | 2 +
apps/workbench/test/integration/projects_test.rb | 124 +++++++++++++++++++++
apps/workbench/test/test_helper.rb | 5 +-
.../test/fixtures/api_client_authorizations.yml | 6 +
services/api/test/fixtures/collections.yml | 28 +++++
services/api/test/fixtures/groups.yml | 61 +++++++++-
services/api/test/fixtures/jobs.yml | 16 +++
services/api/test/fixtures/links.yml | 13 +++
services/api/test/fixtures/pipeline_instances.yml | 63 +++++++++++
services/api/test/fixtures/users.yml | 14 +++
10 files changed, 330 insertions(+), 2 deletions(-)
via 61f351e9e3542308fe0a41fa7f41e4de85130c24 (commit)
from ff9d78bbeb09ca917f0814c6055c47db5a4e7e4a (commit)
Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.
commit 61f351e9e3542308fe0a41fa7f41e4de85130c24
Author: radhika <radhika at curoverse.com>
Date: Thu Oct 16 10:45:24 2014 -0400
4062: fix greedy infinite scrolling in tabs displaying more than one kind (Jobs and pipelines tab and Other objects tab).
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.
diff --git a/apps/workbench/app/controllers/projects_controller.rb b/apps/workbench/app/controllers/projects_controller.rb
index 435e0cd..e918099 100644
--- a/apps/workbench/app/controllers/projects_controller.rb
+++ b/apps/workbench/app/controllers/projects_controller.rb
@@ -206,10 +206,12 @@ class ProjectsController < ApplicationController
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
diff --git a/apps/workbench/test/integration/projects_test.rb b/apps/workbench/test/integration/projects_test.rb
index 83565f9..f0d612b 100644
--- a/apps/workbench/test/integration/projects_test.rb
+++ b/apps/workbench/test/integration/projects_test.rb
@@ -485,4 +485,128 @@ class ProjectsTest < ActionDispatch::IntegrationTest
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
diff --git a/apps/workbench/test/test_helper.rb b/apps/workbench/test/test_helper.rb
index 5253676..eea81d1 100644
--- a/apps/workbench/test/test_helper.rb
+++ b/apps/workbench/test/test_helper.rb
@@ -61,7 +61,10 @@ module ApiFixtureLoader
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
diff --git a/services/api/test/fixtures/api_client_authorizations.yml b/services/api/test/fixtures/api_client_authorizations.yml
index 32560c3..f334281 100644
--- a/services/api/test/fixtures/api_client_authorizations.yml
+++ b/services/api/test/fixtures/api_client_authorizations.yml
@@ -180,3 +180,9 @@ user_foo_in_sharing_group:
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
diff --git a/services/api/test/fixtures/collections.yml b/services/api/test/fixtures/collections.yml
index 2fb235c..d1f1d22 100644
--- a/services/api/test/fixtures/collections.yml
+++ b/services/api/test/fixtures/collections.yml
@@ -257,3 +257,31 @@ collection_owned_by_foo:
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
diff --git a/services/api/test/fixtures/groups.yml b/services/api/test/fixtures/groups.yml
index 8f209e9..3681c7e 100644
--- a/services/api/test/fixtures/groups.yml
+++ b/services/api/test/fixtures/groups.yml
@@ -130,10 +130,69 @@ active_user_has_can_manage:
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
diff --git a/services/api/test/fixtures/jobs.yml b/services/api/test/fixtures/jobs.yml
index 5836809..0096aff 100644
--- a/services/api/test/fixtures/jobs.yml
+++ b/services/api/test/fixtures/jobs.yml
@@ -284,3 +284,19 @@ cancelled:
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
diff --git a/services/api/test/fixtures/links.yml b/services/api/test/fixtures/links.yml
index 9e13971..bca925f 100644
--- a/services/api/test/fixtures/links.yml
+++ b/services/api/test/fixtures/links.yml
@@ -735,3 +735,16 @@ user_bar_is_in_sharing_group:
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: {}
diff --git a/services/api/test/fixtures/pipeline_instances.yml b/services/api/test/fixtures/pipeline_instances.yml
index a3d372b..8aa5977 100644
--- a/services/api/test/fixtures/pipeline_instances.yml
+++ b/services/api/test/fixtures/pipeline_instances.yml
@@ -143,3 +143,66 @@ pipeline_with_newer_template:
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
diff --git a/services/api/test/fixtures/users.yml b/services/api/test/fixtures/users.yml
index 2dd72ab..92fce2c 100644
--- a/services/api/test/fixtures/users.yml
+++ b/services/api/test/fixtures/users.yml
@@ -200,3 +200,17 @@ user_bar_in_sharing_group:
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 at 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
-----------------------------------------------------------------------
hooks/post-receive
--
More information about the arvados-commits
mailing list