X-Git-Url: https://git.arvados.org/arvados.git/blobdiff_plain/c59093180fd92f0d7c6607a49458446212ebd058..41bb13b71c8593134c2b34884249ca862b185e04:/apps/workbench/test/integration/user_manage_account_test.rb diff --git a/apps/workbench/test/integration/user_manage_account_test.rb b/apps/workbench/test/integration/user_manage_account_test.rb index e50907bf8b..8da7b5821d 100644 --- a/apps/workbench/test/integration/user_manage_account_test.rb +++ b/apps/workbench/test/integration/user_manage_account_test.rb @@ -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 @@ -42,13 +42,13 @@ class UserManageAccountTest < ActionDispatch::IntegrationTest 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 @@ class UserManageAccountTest < ActionDispatch::IntegrationTest 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 [ @@ -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.' @@ -180,5 +180,52 @@ class UserManageAccountTest < ActionDispatch::IntegrationTest click_on "Create" end assert_text ":active/workbenchtest.git" + 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