X-Git-Url: https://git.arvados.org/arvados.git/blobdiff_plain/7c4b27bff2d9ad383689217b068b3ba70d463def..f6634dddac1489a463a5eba713a0908a9c72e212:/apps/workbench/test/integration/application_layout_test.rb diff --git a/apps/workbench/test/integration/application_layout_test.rb b/apps/workbench/test/integration/application_layout_test.rb index aae6dc2d8b..78842a408a 100644 --- a/apps/workbench/test/integration/application_layout_test.rb +++ b/apps/workbench/test/integration/application_layout_test.rb @@ -45,19 +45,19 @@ class ApplicationLayoutTest < ActionDispatch::IntegrationTest assert page.has_link? "#{user['email']}" find('a', text: "#{user['email']}").click within('.dropdown-menu') do - if !invited - page.has_no_link? ('Not active') - else - page.has_no_link? ('Sign agreements') - page.has_link? ('Manage account') + if user['is_active'] + assert page.has_no_link? ('Not active') + assert page.has_no_link? ('Sign agreements') + + assert page.has_link? ('Manage account') if profile_config - page.has_link? ('Manage profile') + assert page.has_link? ('Manage profile') else - page.has_no_link? ('Manage profile') + assert page.has_no_link? ('Manage profile') end end - page.has_link? ('Log out') + assert page.has_link? ('Log out') end end end @@ -151,10 +151,10 @@ class ApplicationLayoutTest < ActionDispatch::IntegrationTest page.find_field('name').set 'added_in_test' click_button 'Submit' end - end - # key must be added. look for it in the refreshed page - assert page.has_text? 'added_in_test' + # key must be added. look for it in the refreshed page + assert page.has_text? 'added_in_test' + end end # Check manage profile page and add missing profile to the user @@ -190,14 +190,14 @@ class ApplicationLayoutTest < ActionDispatch::IntegrationTest end end - assert page.has_text? profile_message + assert page.has_text? profile_message.gsub(/<.*?>/,'') assert page.has_text? required_field_title page.find_field('user[prefs][:profile][:'+required_field_key+']').set 'value to fill required field' click_button "Save profile" # profile saved and in profile page now with success assert page.has_text? 'Thank you for filling in your profile' - click_button 'Access Arvados Workbench' + click_link 'Back to work' # profile saved and in home page now assert page.has_text? 'My projects' @@ -259,8 +259,9 @@ class ApplicationLayoutTest < ActionDispatch::IntegrationTest ['active', api_fixture('users')['active'], true, true], ['admin', api_fixture('users')['admin'], true, true], ['active_no_prefs', api_fixture('users')['active_no_prefs'], true, false], + ['active_no_prefs_profile', api_fixture('users')['active_no_prefs_profile'], true, false], ].each do |token, user, invited, has_profile| - test "visit home page when profile is configured for user #{token}" do + test "visit home page when profile is configured for user #{token}" do # Our test config enabled profile by default. So, no need to update config if !token visit ('/') @@ -270,16 +271,7 @@ class ApplicationLayoutTest < ActionDispatch::IntegrationTest verify_homepage_with_profile user, invited, has_profile end - end - [ - [nil, nil, false, false], - ['inactive', api_fixture('users')['inactive'], true, false], - ['inactive_uninvited', api_fixture('users')['inactive_uninvited'], false, false], - ['active', api_fixture('users')['active'], true, true], - ['admin', api_fixture('users')['admin'], true, true], - ['active_no_prefs', api_fixture('users')['active_no_prefs'], true, false], - ].each do |token, user, invited, has_profile| test "visit home page when profile not configured for user #{token}" do Rails.configuration.user_profile_form_fields = false @@ -291,19 +283,8 @@ class ApplicationLayoutTest < ActionDispatch::IntegrationTest verify_homepage_with_profile user, invited, has_profile end - end - [ - [nil, nil, false, false], - ['inactive', api_fixture('users')['inactive'], true, false], - ['inactive_uninvited', api_fixture('users')['inactive_uninvited'], false, false], - ['active', api_fixture('users')['active'], true, true], - ['admin', api_fixture('users')['admin'], true, true], - ['active_no_prefs', api_fixture('users')['active_no_prefs'], true, false], - ].each do |token, user, invited, has_profile| test "check help for user #{token}" do - Rails.configuration.user_profile_form_fields = false - if !token visit ('/') else @@ -322,26 +303,15 @@ class ApplicationLayoutTest < ActionDispatch::IntegrationTest visit page_with_token(token) verify_system_menu user end - end - [ - ['active', api_fixture('users')['active'], true, true], - ['admin', api_fixture('users')['admin'], true, true], - ].each do |token, user| test "test manage account for user #{token}" do visit page_with_token(token) verify_manage_account user end - end - [ - ['active', api_fixture('users')['active'], true, true], - ['admin', api_fixture('users')['admin'], true, true], - ].each do |token, user| test "test search for user #{token}" do visit page_with_token(token) verify_search_box user end end - end