Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
scenario 'user can set up 2 MFA methods properly' do
sign_in_before_2fa

expect(current_path).to eq authentication_methods_setup_path
expect(page).to have_current_path authentication_methods_setup_path

click_2fa_option('phone')
click_2fa_option('backup_code')
Expand All @@ -23,15 +23,15 @@
expect(page).
to have_content t('headings.add_info.phone')

expect(current_path).to eq phone_setup_path
expect(page).to have_current_path phone_setup_path

fill_in 'new_phone_form_phone', with: '703-555-1212'
click_send_one_time_code

fill_in_code_with_last_phone_otp
click_submit_default

expect(current_path).to eq backup_code_setup_path
expect(page).to have_current_path backup_code_setup_path

click_continue

Expand All @@ -41,13 +41,13 @@

expect(page).to have_content(t('notices.backup_codes_configured'))
expect(fake_analytics).to have_logged_event('User registration: complete')
expect(current_path).to eq account_path
expect(page).to have_current_path account_path
end

scenario 'user can select 2 MFA methods and then chooses another method during' do
sign_in_before_2fa

expect(current_path).to eq authentication_methods_setup_path
expect(page).to have_current_path authentication_methods_setup_path

click_2fa_option('phone')
click_2fa_option('backup_code')
Expand All @@ -57,15 +57,15 @@
expect(page).
to have_content t('headings.add_info.phone')

expect(current_path).to eq phone_setup_path
expect(page).to have_current_path phone_setup_path

fill_in 'new_phone_form_phone', with: '703-555-1212'
click_send_one_time_code

fill_in_code_with_last_phone_otp
click_submit_default

expect(current_path).to eq backup_code_setup_path
expect(page).to have_current_path backup_code_setup_path

click_link t('two_factor_authentication.choose_another_option')

Expand All @@ -83,21 +83,21 @@
click_submit_default

expect(fake_analytics).to have_logged_event('User registration: complete')
expect(current_path).to eq account_path
expect(page).to have_current_path account_path
end

scenario 'user can select 2 MFA methods and complete after reauthn window' do
allow(IdentityConfig.store).to receive(:reauthn_window).and_return(10)
sign_in_before_2fa

expect(current_path).to eq authentication_methods_setup_path
expect(page).to have_current_path authentication_methods_setup_path

click_2fa_option('backup_code')
click_2fa_option('auth_app')

click_continue

expect(current_path).to eq authenticator_setup_path
expect(page).to have_current_path authenticator_setup_path

fill_in_totp_name

Expand All @@ -108,10 +108,10 @@
check t('forms.messages.remember_device')
click_submit_default

expect(current_path).to eq backup_code_setup_path
expect(page).to have_current_path backup_code_setup_path
travel_to((IdentityConfig.store.reauthn_window + 5).seconds.from_now) do
click_continue
expect(current_path).to eq login_two_factor_options_path
expect(page).to have_current_path login_two_factor_options_path

find("label[for='two_factor_options_form_selection_auth_app']").click
click_on t('forms.buttons.continue')
Expand All @@ -128,14 +128,14 @@

expect(page).to have_content(t('notices.backup_codes_configured'))

expect(current_path).to eq account_path
expect(page).to have_current_path account_path
end
end

scenario 'user can select 1 MFA methods and will be prompted to add another method' do
sign_in_before_2fa

expect(current_path).to eq authentication_methods_setup_path
expect(page).to have_current_path authentication_methods_setup_path

click_2fa_option('phone')

Expand All @@ -158,7 +158,7 @@

click_button t('mfa.skip')

expect(current_path).to eq account_path
expect(page).to have_current_path account_path
end

describe 'skipping second mfa' do
Expand All @@ -168,7 +168,7 @@
click_2fa_option('backup_code')

click_continue
expect(current_path).to eq backup_code_setup_path
expect(page).to have_current_path backup_code_setup_path

click_continue
expect(page).to have_link(t('components.download_button.label'))
Expand All @@ -189,7 +189,7 @@
click_2fa_option('backup_code')

click_continue
expect(current_path).to eq backup_code_setup_path
expect(page).to have_current_path backup_code_setup_path

click_continue
expect(page).to have_link(t('components.download_button.label'))
Expand All @@ -214,7 +214,7 @@
mock_webauthn_setup_challenge
user = sign_up_and_set_password
user.password = Features::SessionHelper::VALID_PASSWORD
expect(current_path).to eq authentication_methods_setup_path
expect(page).to have_current_path authentication_methods_setup_path
# webauthn option is hidden in browsers that don't support it
select_2fa_option('webauthn_platform', visible: :all)

Expand Down Expand Up @@ -242,13 +242,13 @@
before do
sign_in_before_2fa

expect(current_path).to eq authentication_methods_setup_path
expect(page).to have_current_path authentication_methods_setup_path

click_2fa_option('backup_code')

click_continue

expect(current_path).to eq backup_code_setup_path
expect(page).to have_current_path backup_code_setup_path

click_continue

Expand Down