limit: @limit,
include_linked: true,
filters: (@filters - kind_filters + [['uuid', 'is_a', type]]),
- offset: @offset)
+ )
objects.each do |object|
@name_link_for[object.andand.uuid] = objects.links_for(object, 'name').first
end
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
+ headless = Headless.new
+ headless.start
+ Capybara.current_driver = :selenium
+
+ 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
+ page.execute_script "window.scrollBy(0,999000)"
+ begin
+ wait_for_ajax
+ rescue
+ 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}"
+ 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
+
+ [
+ ['project with 10 pipelines', 10, 0],
+ ['project with 200 jobs and 10 pipelines', 10, 200],
+ ['project with 25 pipelines', 25, 0], # 20 is the page limit for this tab; hence two pages
+ ].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
+ headless = Headless.new
+ headless.start
+ Capybara.current_driver = :selenium
+
+ 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
+ page.execute_script "window.scrollBy(0,999000)"
+ begin
+ wait_for_ajax
+ rescue
+ 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"]')
+ found_pipeline_count = pipelines_found.count
+ (0..found_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
+
+ jobs_found = page.all('tr[data-kind="arvados#job"]')
+ found_job_count = jobs_found.count
+
+ assert_equal num_pipelines, found_pipeline_count, "Found different number of pipelines and jobs"
+ assert_equal num_jobs, found_job_count, 'Did not find expected number of jobs'
+ assert_equal true, verify_pipelines.empty?, "Did not find all the pipelines and 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
keys.inject(@@api_fixtures[name]) { |hash, key| hash[key] }
end
'''load a fixture yaml file'''
with open(os.path.join(SERVICES_SRC_DIR, 'api', "test", "fixtures",
fix + ".yml")) as f:
- return yaml.load(f.read())
+ yaml_file = f.read()
+ try:
+ trim_index = yaml_file.index("# Test Helper trims the rest of the file")
+ yaml_file = yaml_file[0:trim_index]
+ except ValueError:
+ pass
+ return yaml.load(yaml_file)
def authorize_with(token):
'''token is the symbolic name of the token from the api_client_authorizations fixture'''
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-j7d0g-axqo7eu9pwvna1x
created_at: 2014-10-15T10:45:00
name: Collection to remove from subproject
+
+# 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: <%= i.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: <%= i.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_10_pipelines_and_200_jobs:
+ uuid: zzzzz-j7d0g-nnjobspipelines
+ 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 200 jobs and 10 pipelines
+ description: This will result in two pages in the display
+ group_class: project
+
+project_with_25_pipelines:
+ uuid: zzzzz-j7d0g-000025pipelines
+ 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 25 pipelines
+ description: project with 25 pipelines
+ group_class: project
script: hash
script_version: 4fe459abe02d9b365932b8f5dc419439ab4e2577
state: Complete
+
+# 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_10_pipelines_and_200_jobs
+<% for i in 1..200 do %>
+job_<%=i%>_of_200:
+ uuid: zzzzz-8i9sb-0vsrcqi7whch<%= i.to_s.rjust(3, '0') %>
+ created_at: <%= i.minute.ago.to_s(:db) %>
+ owner_uuid: zzzzz-j7d0g-nnjobspipelines
+ 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: <%= i.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_10_pipelines_and_200_jobs
+<% for i in 1..10 do %>
+pipeline_<%=i%>_of_10_pipelines_and_200_jobs:
+ name: pipeline_<%= i %>
+ state: New
+ uuid: zzzzz-d1hrv-abcgneyn6brx<%= i.to_s.rjust(3, '0') %>
+ owner_uuid: zzzzz-j7d0g-nnjobspipelines
+ created_at: <%= i.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_25_pipelines
+<% for i in 1..25 do %>
+pipeline_<%=i%>_of_25:
+ name: pipeline_<%=i%>
+ state: New
+ uuid: zzzzz-d1hrv-25xneyn6br1x<%= i.to_s.rjust(3, '0') %>
+ owner_uuid: zzzzz-j7d0g-000025pipelines
+ created_at: <%= i.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