4062: Merge branch 'master' into 4062-infinite-scroll-repeat-TC
authorTom Clegg <tom@curoverse.com>
Mon, 20 Oct 2014 14:24:10 +0000 (10:24 -0400)
committerTom Clegg <tom@curoverse.com>
Mon, 20 Oct 2014 14:24:10 +0000 (10:24 -0400)
apps/workbench/app/controllers/projects_controller.rb
apps/workbench/test/integration/projects_test.rb
apps/workbench/test/test_helper.rb
sdk/python/tests/run_test_server.py
services/api/test/fixtures/api_client_authorizations.yml
services/api/test/fixtures/collections.yml
services/api/test/fixtures/groups.yml
services/api/test/fixtures/jobs.yml
services/api/test/fixtures/links.yml
services/api/test/fixtures/pipeline_instances.yml
services/api/test/fixtures/users.yml

index 435e0cd5d68f9086a1cf83ea8d5377d360daedac..b77a48973f5a32f3a33685e6d0dc749f3c6c5027 100644 (file)
@@ -192,7 +192,7 @@ class ProjectsController < ApplicationController
                                      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
index 83565f939dbeef6a2ab6afdbea375b286cc77d45..b6234907e4a2794764b2e4cc9643ba561ae7d65c 100644 (file)
@@ -485,4 +485,126 @@ 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
+      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
index 1a07e43be1fb51c5fe3c9a7796121ea684a9407c..89341a6323ed5742a02bc457dfd4004c2872e9dd 100644 (file)
@@ -64,7 +64,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
       keys.inject(@@api_fixtures[name]) { |hash, key| hash[key] }
     end
index 0ad6725831deb78801cd497c4d4fd149024da706..bd3419c89dae47d857c22cd199c49f1722c3f8e0 100644 (file)
@@ -231,7 +231,13 @@ def fixture(fix):
     '''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'''
index 8f7b1259932701cc47b4d6a89157ab0ae73c0e1e..3b5df3795c097bdd33b026a2599eb32f10cacb34 100644 (file)
@@ -186,3 +186,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
index e1e568aa1b0c26e16d3f6464e1a00980168abed2..c481424d6d29160778ee7843f2da9bb4a65994a8 100644 (file)
@@ -266,3 +266,31 @@ collection_to_remove_from_subproject:
   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
index 8f209e9b9c691b56da02c187aba8302932c0fe8e..61c4b0a81c74c58ca065d3fe3854a2e613145372 100644 (file)
@@ -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_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
index 5e383ed5c0455ac37e37c0ef1a7811a10e57598c..292c27e2e37057848050f2d81da7e79d89eb0d53 100644 (file)
@@ -294,3 +294,19 @@ job_in_subproject:
   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
index 1771fcc0fd5ed6f21f045966aab4d3d7f60232c7..899e9f0b3b615bb0df5a8c73f56c67db1f650b54 100644 (file)
@@ -749,3 +749,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: {}
index 2fc28ec93ed88c0a139b134ede37a6fe96aebeb6..fd616cde932423bf0bd511638a10a5618d0e2154 100644 (file)
@@ -149,3 +149,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: <%= 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
index 9cd2db8f8e88657499f022db66f1a27f395c2f8b..17ae82e901246bab0471efa26cc6fa454ff27cdd 100644 (file)
@@ -214,3 +214,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@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