summaryrefslogtreecommitdiff
path: root/spec/features/profiles/two_factor_auths_spec.rb
diff options
context:
space:
mode:
Diffstat (limited to 'spec/features/profiles/two_factor_auths_spec.rb')
-rw-r--r--spec/features/profiles/two_factor_auths_spec.rb25
1 files changed, 22 insertions, 3 deletions
diff --git a/spec/features/profiles/two_factor_auths_spec.rb b/spec/features/profiles/two_factor_auths_spec.rb
index 3f5789e119a..a9256a73d7b 100644
--- a/spec/features/profiles/two_factor_auths_spec.rb
+++ b/spec/features/profiles/two_factor_auths_spec.rb
@@ -45,6 +45,19 @@ RSpec.describe 'Two factor auths' do
expect(page).to have_content('Status: Enabled')
end
end
+
+ context 'when invalid pin is provided' do
+ let_it_be(:user) { create(:omniauth_user) }
+
+ it 'renders a error alert with a link to the troubleshooting section' do
+ visit profile_two_factor_auth_path
+
+ fill_in 'pin_code', with: '123'
+ click_button 'Register with two-factor app'
+
+ 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
end
context 'when user has two-factor authentication enabled' do
@@ -57,7 +70,9 @@ RSpec.describe 'Two factor auths' do
click_button 'Disable two-factor authentication'
- page.accept_alert
+ page.within('[role="dialog"]') do
+ click_button 'Disable'
+ end
expect(page).to have_content('You must provide a valid current password')
@@ -65,7 +80,9 @@ RSpec.describe 'Two factor auths' do
click_button 'Disable two-factor authentication'
- page.accept_alert
+ page.within('[role="dialog"]') do
+ click_button 'Disable'
+ end
expect(page).to have_content('Two-factor authentication has been disabled successfully!')
expect(page).to have_content('Enable two-factor authentication')
@@ -95,7 +112,9 @@ RSpec.describe 'Two factor auths' do
click_button 'Disable two-factor authentication'
- page.accept_alert
+ page.within('[role="dialog"]') do
+ click_button 'Disable'
+ end
expect(page).to have_content('Two-factor authentication has been disabled successfully!')
expect(page).to have_content('Enable two-factor authentication')