3775: Merge branch 'master' into 3775-fetch-git-repo
[arvados.git] / apps / workbench / test / integration / projects_test.rb
index 7c5f9a6294bb999ebcb86c357efceb7fe51e8cff..ae156b8a5329f311a0c0061b69ed3737a855acef 100644 (file)
@@ -7,6 +7,13 @@ class ProjectsTest < ActionDispatch::IntegrationTest
     Capybara.current_driver = Capybara.javascript_driver
   end
 
+  test 'Check collection count for A Project in the tab pane titles' do
+    project_uuid = api_fixture('groups')['aproject']['uuid']
+    visit page_with_token 'active', '/projects/' + project_uuid
+    collection_count = page.all("[data-pk*='collection']").count
+    assert_selector '#Data_collections-tab span', text: "(#{collection_count})"
+  end
+
   test 'Find a project and edit its description' do
     visit page_with_token 'active', '/'
     find("#projects-menu").click
@@ -154,7 +161,7 @@ class ProjectsTest < ActionDispatch::IntegrationTest
     end
     wait_for_ajax
 
-    click_link 'Move project...'
+    click_link 'Move to project...'
     find('.selectable', text: 'Project 1234').click
     find('.modal-footer a,button', text: 'Move').click
     wait_for_ajax
@@ -259,15 +266,16 @@ class ProjectsTest < ActionDispatch::IntegrationTest
   end
 
   [
-    'Move',
-    'Remove',
-    'Copy',
-  ].each do |action|
-    test "selection #{action} for project" do
-      src = api_fixture('groups')['aproject']
-      dest = api_fixture('groups')['asubproject']
-      my_collection = api_fixture('collections')['collection_to_move_around_in_aproject']
-
+    ['Move',api_fixture('collections')['collection_to_move_around_in_aproject'],
+      api_fixture('groups')['aproject'],api_fixture('groups')['asubproject']],
+    ['Remove',api_fixture('collections')['collection_to_move_around_in_aproject'],
+      api_fixture('groups')['aproject']],
+    ['Copy',api_fixture('collections')['collection_to_move_around_in_aproject'],
+      api_fixture('groups')['aproject'],api_fixture('groups')['asubproject']],
+    ['Remove',api_fixture('collections')['collection_in_aproject_with_same_name_as_in_home_project'],
+      api_fixture('groups')['aproject'],nil,true],
+  ].each do |action, my_collection, src, dest=nil, expect_name_change=nil|
+    test "selection #{action} #{expect_name_change} for project" do
       perform_selection_action src, dest, my_collection, action
 
       case action
@@ -295,6 +303,10 @@ class ProjectsTest < ActionDispatch::IntegrationTest
         find("#projects-menu").click
         find(".dropdown-menu a", text: "Home").click
         assert page.has_text?(my_collection['name']), 'Collection not found in home project after remove'
+        if expect_name_change
+          assert page.has_text?(my_collection['name']+' removed from ' + src['name']),
+            'Collection with update name is not found in home project after remove'
+        end
       end
     end
   end
@@ -450,4 +462,15 @@ class ProjectsTest < ActionDispatch::IntegrationTest
     assert page.has_link?('Jobs and pipelines'), 'Jobs and pipelines link not found in project'
   end
 
+  [["jobs", "/jobs"],
+   ["pipelines", "/pipeline_instances"],
+   ["collections", "/collections"]
+  ].each do |target,path|
+    test "Test dashboard button all #{target}" do
+      visit page_with_token 'active', '/'
+      click_link "All #{target}"
+      assert_equal path, current_path
+    end
+  end
+
 end