diff options
Diffstat (limited to 'spec/features/users')
-rw-r--r-- | spec/features/users/login_spec.rb | 18 | ||||
-rw-r--r-- | spec/features/users/show_spec.rb | 19 |
2 files changed, 32 insertions, 5 deletions
diff --git a/spec/features/users/login_spec.rb b/spec/features/users/login_spec.rb index 79c4057a8b9..10c1c2cb26e 100644 --- a/spec/features/users/login_spec.rb +++ b/spec/features/users/login_spec.rb @@ -171,6 +171,18 @@ RSpec.describe 'Login', :clean_gitlab_redis_shared_state do end end + describe 'with OneTrust authentication' do + before do + stub_config(extra: { one_trust_id: SecureRandom.uuid }) + end + + it 'has proper Content-Security-Policy headers' do + visit root_path + + expect(response_headers['Content-Security-Policy']).to include('https://cdn.cookielaw.org https://*.onetrust.com') + end + end + describe 'with two-factor authentication', :js do def enter_code(code) fill_in 'user_otp_attempt', with: code @@ -866,8 +878,8 @@ RSpec.describe 'Login', :clean_gitlab_redis_shared_state do expect(current_path).to eq(new_profile_password_path) - fill_in 'user_current_password', with: '12345678' - fill_in 'user_password', with: 'new password' + fill_in 'user_password', with: '12345678' + fill_in 'user_new_password', with: 'new password' fill_in 'user_password_confirmation', with: 'new password' click_button 'Set new password' @@ -875,7 +887,7 @@ RSpec.describe 'Login', :clean_gitlab_redis_shared_state do end end - context 'when the user does not have an email configured' do + context 'when the user does not have an email configured', :js do let(:user) { create(:omniauth_user, extern_uid: 'my-uid', provider: 'saml', email: 'temp-email-for-oauth-user@gitlab.localhost') } before do diff --git a/spec/features/users/show_spec.rb b/spec/features/users/show_spec.rb index e629d329033..61672662fbe 100644 --- a/spec/features/users/show_spec.rb +++ b/spec/features/users/show_spec.rb @@ -81,6 +81,7 @@ RSpec.describe 'User page' do context 'timezone' do let_it_be(:timezone) { 'America/Los_Angeles' } + let_it_be(:local_time_selector) { '[data-testid="user-local-time"]' } before do travel_to Time.find_zone(timezone).local(2021, 7, 20, 15, 30, 45) @@ -92,7 +93,19 @@ RSpec.describe 'User page' do it 'shows local time' do subject - expect(page).to have_content('3:30 PM') + within local_time_selector do + expect(page).to have_content('3:30 PM') + end + end + end + + context 'when timezone is not set' do + let_it_be(:user) { create(:user, timezone: nil) } + + it 'does not show local time' do + subject + + expect(page).not_to have_selector(local_time_selector) end end @@ -102,7 +115,9 @@ RSpec.describe 'User page' do it 'shows local time using the configured default timezone (UTC in this case)' do subject - expect(page).to have_content('10:30 PM') + within local_time_selector do + expect(page).to have_content('10:30 PM') + end end end end |