diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2022-09-19 23:18:09 +0000 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2022-09-19 23:18:09 +0000 |
commit | 6ed4ec3e0b1340f96b7c043ef51d1b33bbe85fde (patch) | |
tree | dc4d20fe6064752c0bd323187252c77e0a89144b /spec/features/users | |
parent | 9868dae7fc0655bd7ce4a6887d4e6d487690eeed (diff) | |
download | gitlab-ce-6ed4ec3e0b1340f96b7c043ef51d1b33bbe85fde.tar.gz |
Add latest changes from gitlab-org/gitlab@15-4-stable-eev15.4.0-rc42
Diffstat (limited to 'spec/features/users')
-rw-r--r-- | spec/features/users/email_verification_on_login_spec.rb | 35 | ||||
-rw-r--r-- | spec/features/users/login_spec.rb | 4 | ||||
-rw-r--r-- | spec/features/users/show_spec.rb | 4 | ||||
-rw-r--r-- | spec/features/users/signup_spec.rb | 7 |
4 files changed, 27 insertions, 23 deletions
diff --git a/spec/features/users/email_verification_on_login_spec.rb b/spec/features/users/email_verification_on_login_spec.rb index c8301c2fc91..f7102eaf9b7 100644 --- a/spec/features/users/email_verification_on_login_spec.rb +++ b/spec/features/users/email_verification_on_login_spec.rb @@ -118,7 +118,7 @@ RSpec.describe 'Email Verification On Login', :clean_gitlab_redis_rate_limiting # Expect an error message expect_log_message('Failed Attempt', reason: 'rate_limited') expect(page).to have_content("You've reached the maximum amount of tries. "\ - 'Wait 10 minutes or resend a new code and try again.') + 'Wait 10 minutes or send a new code and try again.') # Wait for 10 minutes travel 10.minutes @@ -138,7 +138,7 @@ RSpec.describe 'Email Verification On Login', :clean_gitlab_redis_rate_limiting # Expect an error message expect_log_message('Failed Attempt', reason: 'invalid') - expect(page).to have_content('The code is incorrect. Enter it again, or resend a new code.') + expect(page).to have_content('The code is incorrect. Enter it again, or send a new code.') end it 'verifies expired codes' do @@ -150,12 +150,12 @@ RSpec.describe 'Email Verification On Login', :clean_gitlab_redis_rate_limiting code = expect_instructions_email_and_extract_code # Wait for the code to expire before verifying - travel VerifiesWithEmail::TOKEN_VALID_FOR_MINUTES.minutes + 1.second + travel Users::EmailVerification::ValidateTokenService::TOKEN_VALID_FOR_MINUTES.minutes + 1.second verify_code(code) # Expect an error message expect_log_message('Failed Attempt', reason: 'expired') - expect(page).to have_content('The code has expired. Resend a new code and try again.') + expect(page).to have_content('The code has expired. Send a new code and try again.') end end end @@ -255,7 +255,7 @@ RSpec.describe 'Email Verification On Login', :clean_gitlab_redis_rate_limiting perform_enqueued_jobs do # The user is prompted for a verification code gitlab_sign_in(user) - expect(page).to have_content('Help us protect your account') + expect(page).to have_content(s_('IdentityVerification|Help us protect your account')) code = expect_instructions_email_and_extract_code # We toggle the feature flag off @@ -266,12 +266,13 @@ RSpec.describe 'Email Verification On Login', :clean_gitlab_redis_rate_limiting new_code = expect_instructions_email_and_extract_code verify_code(code) - expect(page).to have_content('The code is incorrect. Enter it again, or resend a new code.') + expect(page) + .to have_content(s_('IdentityVerification|The code is incorrect. Enter it again, or send a new code.')) - travel VerifiesWithEmail::TOKEN_VALID_FOR_MINUTES.minutes + 1.second + travel Users::EmailVerification::ValidateTokenService::TOKEN_VALID_FOR_MINUTES.minutes + 1.second verify_code(new_code) - expect(page).to have_content('The code has expired. Resend a new code and try again.') + expect(page).to have_content(s_('IdentityVerification|The code has expired. Send a new code and try again.')) click_link 'Resend code' another_code = expect_instructions_email_and_extract_code @@ -296,7 +297,7 @@ RSpec.describe 'Email Verification On Login', :clean_gitlab_redis_rate_limiting it 'the unlock link still works' do # The user is locked and unlock instructions are sent - expect(page).to have_content('Invalid login or password.') + expect(page).to have_content(_('Invalid login or password.')) user.reload expect(user.locked_at).not_to be_nil expect(user.unlock_token).not_to be_nil @@ -334,24 +335,24 @@ RSpec.describe 'Email Verification On Login', :clean_gitlab_redis_rate_limiting def expect_instructions_email_and_extract_code mail = find_email_for(user) expect(mail.to).to match_array([user.email]) - expect(mail.subject).to eq('Verify your identity') - code = mail.body.parts.first.to_s[/\d{#{VerifiesWithEmail::TOKEN_LENGTH}}/o] + expect(mail.subject).to eq(s_('IdentityVerification|Verify your identity')) + code = mail.body.parts.first.to_s[/\d{#{Users::EmailVerification::GenerateTokenService::TOKEN_LENGTH}}/o] reset_delivered_emails! code end def verify_code(code) - fill_in 'Verification code', with: code - click_button 'Verify code' + fill_in s_('IdentityVerification|Verification code'), with: code + click_button s_('IdentityVerification|Verify code') end def expect_log_message(event = nil, times = 1, reason: '', message: nil) expect(Gitlab::AppLogger).to have_received(:info) .exactly(times).times .with(message || hash_including(message: 'Email Verification', - event: event, - username: user.username, - ip: '127.0.0.1', - reason: reason)) + event: event, + username: user.username, + ip: '127.0.0.1', + reason: reason)) end end diff --git a/spec/features/users/login_spec.rb b/spec/features/users/login_spec.rb index b875dbe1340..5ca5bd72b79 100644 --- a/spec/features/users/login_spec.rb +++ b/spec/features/users/login_spec.rb @@ -105,6 +105,7 @@ RSpec.describe 'Login', :clean_gitlab_redis_sessions do before do stub_application_setting(send_user_confirmation_email: true) allow(User).to receive(:allow_unconfirmed_access_for).and_return grace_period + stub_feature_flags(identity_verification: false) end context 'within the grace period' do @@ -862,7 +863,7 @@ RSpec.describe 'Login', :clean_gitlab_redis_sessions do context 'when the user already enabled 2FA' do before do user.update!(otp_required_for_login: true, - otp_secret: User.generate_otp_secret(32)) + otp_secret: User.generate_otp_secret(32)) end it 'asks the user to accept the terms' do @@ -954,6 +955,7 @@ RSpec.describe 'Login', :clean_gitlab_redis_sessions do before do stub_application_setting(send_user_confirmation_email: true) stub_feature_flags(soft_email_confirmation: true) + stub_feature_flags(identity_verification: false) allow(User).to receive(:allow_unconfirmed_access_for).and_return grace_period end diff --git a/spec/features/users/show_spec.rb b/spec/features/users/show_spec.rb index 068e1fd4243..bbf5882f89f 100644 --- a/spec/features/users/show_spec.rb +++ b/spec/features/users/show_spec.rb @@ -339,7 +339,7 @@ RSpec.describe 'User page' do subject - page.within '.navbar-nav' do + page.within '.navbar-gitlab' do expect(page).to have_link('Sign in') end end @@ -351,7 +351,7 @@ RSpec.describe 'User page' do subject - page.within '.navbar-nav' do + page.within '.navbar-gitlab' do expect(page).to have_link('Sign in / Register') end end diff --git a/spec/features/users/signup_spec.rb b/spec/features/users/signup_spec.rb index f2381e41de8..de53e722603 100644 --- a/spec/features/users/signup_spec.rb +++ b/spec/features/users/signup_spec.rb @@ -66,6 +66,7 @@ RSpec.describe 'Signup' do flag_values = [true, false] flag_values.each do |val| before do + stub_feature_flags(arkose_labs_signup_challenge: false) stub_feature_flags(restyle_login_page: val) stub_application_setting(require_admin_approval_after_user_signup: false) end @@ -202,6 +203,7 @@ RSpec.describe 'Signup' do context 'when soft email confirmation is not enabled' do before do stub_feature_flags(soft_email_confirmation: false) + stub_feature_flags(identity_verification: false) end it 'creates the user account and sends a confirmation email, and pre-fills email address after confirming' do @@ -297,9 +299,8 @@ RSpec.describe 'Signup' do enforce_terms end - it 'renders text that the user confirms terms by clicking register' do + it 'renders text that the user confirms terms by signing in' do visit new_user_registration_path - expect(page).to have_content(/By clicking Register, I agree that I have read and accepted the Terms of Use and Privacy Policy/) fill_in_signup_form @@ -391,7 +392,7 @@ RSpec.describe 'Signup' do enforce_terms end - it 'renders text that the user confirms terms by clicking register' do + it 'renders text that the user confirms terms by signing in' do visit new_user_registration_path expect(page).to have_content(/By clicking Register, I agree that I have read and accepted the Terms of Use and Privacy Policy/) |