Merge branch 'master' into 6588-split-manage-account
authorManoj <jonam33@gmail.com>
Mon, 3 Aug 2015 14:02:23 +0000 (10:02 -0400)
committerManoj <jonam33@gmail.com>
Mon, 3 Aug 2015 14:02:23 +0000 (10:02 -0400)
1  2 
apps/workbench/test/integration/user_manage_account_test.rb

index c86ba0c83ef0ab95f81a1706274a884e88bdff78,1b80daf03ce49905e8ed4097496544c958a432bf..8da7b5821d57720823df65570908b740579511c8
@@@ -11,16 -11,16 +11,16 @@@ class UserManageAccountTest < ActionDis
        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
  
          page.find_field('public_key').set 'first test with an incorrect ssh key value'
          click_button 'Submit'
-         assert page.has_text?('Public key does not appear to be a valid ssh-rsa or dsa public key'), 'No text - Public key does not appear to be a valid'
+         assert_text 'Public key does not appear to be a valid ssh-rsa or dsa public key'
  
          public_key_str = api_fixture('authorized_keys')['active']['public_key']
          page.find_field('public_key').set public_key_str
          page.find_field('name').set 'added_in_test'
          click_button 'Submit'
-         assert page.has_text?('Public key already exists in the database, use a different key.'), 'No text - Public key already exists'
+         assert_text 'Public key already exists in the database, use a different key.'
  
          new_key = SSHKey.generate
          page.find_field('public_key').set new_key.ssh_public_key
@@@ -57,7 -57,7 +57,7 @@@
        end
  
        # key must be added. look for it in the refreshed page
-       assert page.has_text?('added_in_test'), 'No text - added_in_test'
+       assert_text 'added_in_test'
    end
  
    [
      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.'
      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