From 8a560d56661f56804ddf6596f928e7d25db37443 Mon Sep 17 00:00:00 2001 From: GitLab Bot Date: Thu, 18 May 2023 00:08:02 +0000 Subject: Add latest changes from gitlab-org/gitlab@master --- .../user_merges_when_pipeline_succeeds_spec.rb | 2 +- spec/features/profiles/two_factor_auths_spec.rb | 34 ++++++++++++++++++++++ 2 files changed, 35 insertions(+), 1 deletion(-) (limited to 'spec') diff --git a/spec/features/merge_request/user_merges_when_pipeline_succeeds_spec.rb b/spec/features/merge_request/user_merges_when_pipeline_succeeds_spec.rb index 5c00da1f569..576ce23b058 100644 --- a/spec/features/merge_request/user_merges_when_pipeline_succeeds_spec.rb +++ b/spec/features/merge_request/user_merges_when_pipeline_succeeds_spec.rb @@ -111,7 +111,7 @@ RSpec.describe 'Merge request > User merges when pipeline succeeds', :js, featur describe 'enabling Merge when pipeline succeeds' do shared_examples 'Set to auto-merge activator' do - it 'activates the Merge when pipeline succeeds feature' do + it 'activates the Merge when pipeline succeeds feature', quarantine: 'https://gitlab.com/gitlab-org/gitlab/-/issues/410055' do click_button "Set to auto-merge" expect(page).to have_content "Set by #{user.name} to be merged automatically when the pipeline succeeds" diff --git a/spec/features/profiles/two_factor_auths_spec.rb b/spec/features/profiles/two_factor_auths_spec.rb index e8ff8416722..b52f66cfcee 100644 --- a/spec/features/profiles/two_factor_auths_spec.rb +++ b/spec/features/profiles/two_factor_auths_spec.rb @@ -62,6 +62,40 @@ RSpec.describe 'Two factor auths', feature_category: :user_profile do expect(page).to have_link('Try the troubleshooting steps here.', href: help_page_path('user/profile/account/two_factor_authentication.md', anchor: 'troubleshooting')) end end + + context 'when two factor is enforced in global settings' do + before do + stub_application_setting(require_two_factor_authentication: true) + end + + context 'when invalid pin is provided' do + let_it_be(:user) { create(:omniauth_user) } + + it 'renders alert for global settings' do + visit profile_two_factor_auth_path + + fill_in 'pin_code', with: '123' + click_button 'Register with two-factor app' + + expect(page).to have_content('The global settings require you to enable Two-Factor Authentication for your account. You need to do this before ') + end + end + + context 'when invalid password is provided' do + let_it_be(:user) { create(:user) } + + it 'renders a error alert with a link to the troubleshooting section' do + visit profile_two_factor_auth_path + + register_2fa(user.current_otp, 'abc') + click_button 'Register with two-factor app' + + expect(page).to have_content( + 'The global settings require you to enable Two-Factor Authentication for your account' + ) + end + end + end end context 'when user has two-factor authentication enabled' do -- cgit v1.2.1