X-Git-Url: https://git.arvados.org/arvados.git/blobdiff_plain/29d73c8ab33b0d9c34074cd09e581cd7584da31e..432ec6a698a5ff2616541745aa7afa9074b970c3:/apps/workbench/test/integration/user_settings_menu_test.rb diff --git a/apps/workbench/test/integration/user_settings_menu_test.rb b/apps/workbench/test/integration/user_settings_menu_test.rb index 147b48702b..6f3ca9dd5c 100644 --- a/apps/workbench/test/integration/user_settings_menu_test.rb +++ b/apps/workbench/test/integration/user_settings_menu_test.rb @@ -1,3 +1,7 @@ +# Copyright (C) The Arvados Authors. All rights reserved. +# +# SPDX-License-Identifier: AGPL-3.0 + require 'integration_helper' class UserSettingsMenuTest < ActionDispatch::IntegrationTest @@ -42,7 +46,7 @@ class UserSettingsMenuTest < ActionDispatch::IntegrationTest page.find_field('public_key').set 'first test with an incorrect ssh key value' click_button 'Submit' - assert_text 'Public key does not appear to be a valid ssh-rsa or dsa public key' + assert_text 'Public key does not appear to be valid' public_key_str = api_fixture('authorized_keys')['active']['public_key'] page.find_field('public_key').set public_key_str @@ -74,7 +78,7 @@ class UserSettingsMenuTest < ActionDispatch::IntegrationTest test "pipeline notification shown even though public pipelines exist" do skip "created_by doesn't work that way" - Rails.configuration.anonymous_user_token = api_fixture('api_client_authorizations')['anonymous']['api_token'] + Rails.configuration.Users.AnonymousUserToken = api_fixture('api_client_authorizations')['anonymous']['api_token'] visit page_with_token 'job_reader' click_link 'notifications-menu' assert_selector 'a', text: 'Click here to learn how to run an Arvados Crunch pipeline' @@ -85,7 +89,7 @@ class UserSettingsMenuTest < ActionDispatch::IntegrationTest ['active'], ].each do |user, *expect| test "user settings menu for #{user} with notifications #{expect.inspect}" do - Rails.configuration.anonymous_user_token = false + Rails.configuration.Users.AnonymousUserToken = "" visit page_with_token(user) click_link 'notifications-menu' if expect.include? :ssh @@ -110,24 +114,21 @@ class UserSettingsMenuTest < ActionDispatch::IntegrationTest end test "verify repositories for active user" do - visit page_with_token('active',"/users/#{api_fixture('users')['active']['uuid']}/repositories") - repos = [[api_fixture('repositories')['foo'], true, true], - [api_fixture('repositories')['repository3'], false, false], - [api_fixture('repositories')['repository4'], true, false]] + visit page_with_token('active',"/repositories") + + repos = [[api_fixture('repositories')['foo'], true], + [api_fixture('repositories')['repository3'], false], + [api_fixture('repositories')['repository4'], false], + [api_fixture('repositories')['arvados'], false]] - repos.each do |(repo, writable, sharable)| + repos.each do |(repo, owned)| within('tr', text: repo['name']+'.git') do - if sharable - assert_selector 'a', text:'Share' - assert_text 'writable' + assert_text repo['name'] + assert_selector 'a', text:'Show' + if owned + assert_not_nil first('.glyphicon-trash') else - assert_text repo['name'] - assert_no_selector 'a', text:'Share' - if writable - assert_text 'writable' - else - assert_text 'read-only' - end + assert_nil first('.glyphicon-trash') end end end @@ -187,17 +188,17 @@ class UserSettingsMenuTest < ActionDispatch::IntegrationTest end assert_text ":active/workbenchtest.git" assert_match /git@git.*:active\/workbenchtest.git/, page.text - assert_match /https:\/\/git.*\/active\/workbenchtest.git/, page.text + assert_match /#{Rails.configuration.Services.GitHTTP.ExternalURL.to_s}active\/workbenchtest.git/, page.text end [ ['virtual_machines', nil, 'Host name', 'testvm2.shell'], - ['repositories', 'Add new repository', 'It may take a minute or two before you can clone your new repository.', 'active/foo'], + ['/repositories', 'Add new repository', 'It may take a minute or two before you can clone your new repository.', 'active/foo'], ['/current_token', nil, 'HISTIGNORE=$HISTIGNORE', 'ARVADOS_API_TOKEN=3kg6k6lzmp9kj5'], ['ssh_keys', 'Add new SSH key', 'Click here to learn about SSH keys in Arvados.', 'active'], ].each do |page_name, button_name, look_for, content| test "test user settings menu for page #{page_name}" do - if page_name == '/current_token' + if page_name == '/current_token' || page_name == '/repositories' visit page_with_token('active', page_name) else visit page_with_token('active', "/users/#{api_fixture('users')['active']['uuid']}/#{page_name}") @@ -215,18 +216,21 @@ class UserSettingsMenuTest < ActionDispatch::IntegrationTest [ ['virtual_machines', 'You do not have access to any virtual machines.'], - ['repositories', 'You do not seem to have access to any repositories.'], + ['/repositories', api_fixture('repositories')['arvados']['name']], ['/current_token', 'HISTIGNORE=$HISTIGNORE'], ['ssh_keys', 'You have not yet set up an SSH public key for use with Arvados.'], ].each do |page_name, look_for| test "test user settings menu for page #{page_name} when page is empty" do - if page_name == '/current_token' + if page_name == '/current_token' || page_name == '/repositories' visit page_with_token('user1_with_load', page_name) else visit page_with_token('admin', "/users/#{api_fixture('users')['user1_with_load']['uuid']}/#{page_name}") end - assert page.has_text? look_for + assert page.has_text? look_for + if page_name == '/repositories' + assert_equal 1, page.all('a[data-original-title="show repository"]').count + end end end end