diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2022-04-20 10:00:54 +0000 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2022-04-20 10:00:54 +0000 |
commit | 3cccd102ba543e02725d247893729e5c73b38295 (patch) | |
tree | f36a04ec38517f5deaaacb5acc7d949688d1e187 /spec/features/users/login_spec.rb | |
parent | 205943281328046ef7b4528031b90fbda70c75ac (diff) | |
download | gitlab-ce-3cccd102ba543e02725d247893729e5c73b38295.tar.gz |
Add latest changes from gitlab-org/gitlab@14-10-stable-eev14.10.0-rc42
Diffstat (limited to 'spec/features/users/login_spec.rb')
-rw-r--r-- | spec/features/users/login_spec.rb | 11 |
1 files changed, 9 insertions, 2 deletions
diff --git a/spec/features/users/login_spec.rb b/spec/features/users/login_spec.rb index 8610cae58a4..822bf898034 100644 --- a/spec/features/users/login_spec.rb +++ b/spec/features/users/login_spec.rb @@ -818,7 +818,6 @@ RSpec.describe 'Login', :clean_gitlab_redis_sessions do context 'when 2FA is required for the user' do before do - stub_feature_flags(mr_attention_requests: false) group = create(:group, require_two_factor_authentication: true) group.add_developer(user) end @@ -840,7 +839,15 @@ RSpec.describe 'Login', :clean_gitlab_redis_sessions do expect(page).to have_current_path(profile_two_factor_auth_path, ignore_query: true) - fill_in 'pin_code', with: user.reload.current_otp + # Use the secret shown on the page to generate the OTP that will be entered. + # This detects issues wherein a new secret gets generated after the + # page is shown. + wait_for_requests + + otp_secret = page.find('.two-factor-secret').text.gsub('Key:', '').delete(' ') + current_otp = ROTP::TOTP.new(otp_secret).now + + fill_in 'pin_code', with: current_otp fill_in 'current_password', with: user.password click_button 'Register with two-factor app' |