Merge branch 'master' into 6588-split-manage-account
[arvados.git] / apps / workbench / test / integration / user_manage_account_test.rb
index 1b80daf03ce49905e8ed4097496544c958a432bf..8da7b5821d57720823df65570908b740579511c8 100644 (file)
@@ -11,16 +11,16 @@ class UserManageAccountTest < ActionDispatch::IntegrationTest
       within('.navbar-fixed-top') do
         page.find("#notifications-menu").click
         within('.dropdown-menu') do
-          find('a', text: 'Manage account').click
+          assert_selector 'a', text: 'My virtual machines'
+          assert_selector 'a', text: 'My repositories'
+          assert_selector 'a', text: 'My current token'
+          assert_selector 'a', text: 'My SSH keys'
+          find('a', text: 'My SSH keys').click
         end
       end
 
-      # now in manage account page
-      assert page.has_text?('Virtual Machines'), 'No text - Virtual Machines'
-      assert page.has_text?('Repositories'), 'No text - Repositories'
-      assert page.has_text?('SSH Keys'), 'No text - SSH Keys'
-      assert page.has_text?('Current Token'), 'No text - Current Token'
-      assert page.has_text?('The Arvados API token is a secret key that enables the Arvados SDKs to access Arvados'), 'No text - Arvados API token'
+      # now in My SSH Keys page
+      assert page.has_text?('Add new SSH key'), 'No text - Add SSH key'
       add_and_verify_ssh_key
     else  # inactive user
       within('.navbar-fixed-top') do
@@ -164,7 +164,7 @@ class UserManageAccountTest < ActionDispatch::IntegrationTest
     within('.navbar-fixed-top') do
       page.find("#notifications-menu").click
       within('.dropdown-menu') do
-        find('a', text: 'Manage account').click
+        find('a', text: 'My virtual machines').click
       end
     end
     assert_text 'You do not have access to any virtual machines.'
@@ -183,4 +183,49 @@ class UserManageAccountTest < ActionDispatch::IntegrationTest
     assert_match /git@git.*:active\/workbenchtest.git/, page.text
     assert_match /https:\/\/git.*\/active\/workbenchtest.git/, page.text
   end
+
+  [
+    ['My virtual machines', nil, 'Host name'],
+    ['My repositories', 'Add new repository', 'It may take a minute or two before you can clone your new repository.'],
+    ['My current token', nil, 'HISTIGNORE=$HISTIGNORE'],
+    ['My SSH keys', 'Add new SSH key', 'Click here to learn about SSH keys in Arvados.'],
+  ].each do |page_name, button_name, look_for|
+    test "test notification menu for page #{page_name}" do
+      visit page_with_token('admin')
+      within('.navbar-fixed-top') do
+          page.find("#notifications-menu").click
+          within('.dropdown-menu') do
+            assert_selector 'a', text: page_name
+            find('a', text: page_name).click
+          end
+      end
+
+      if button_name
+        assert_selector 'a', text: button_name
+        find('a', text: button_name).click
+      end
+
+      assert page.has_text? look_for
+    end
+  end
+
+  [
+    ['My virtual machines', 'You do not have access to any virtual machines.'],
+    ['My repositories', 'You do not seem to have access to any repositories.'],
+    ['My current token', 'HISTIGNORE=$HISTIGNORE'],
+    ['My SSH keys', 'You have not yet set up an SSH public key for use with Arvados.'],
+  ].each do |page_name, look_for|
+    test "test notification menu for page #{page_name} when page is empty" do
+      visit page_with_token('user1_with_load')
+      within ('.navbar-fixed-top') do
+        page.find("#notifications-menu").click
+        within('.dropdown-menu') do
+          assert_selector 'a', text: page_name
+          find('a', text: page_name).click
+        end
+      end
+
+     assert page.has_text? look_for
+    end
+  end
 end