-
Notifications
You must be signed in to change notification settings - Fork 166
LG-14397: Remove use_fed_domain_class #11326
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
167 changes: 49 additions & 118 deletions
167
spec/features/sign_in/piv_recommended_after_sign_in_spec.rb
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,132 +1,63 @@ | ||
| require 'rails_helper' | ||
|
|
||
| RSpec.feature 'Piv recommended after Sign in' do | ||
| context 'use_fed_domain_class set to true' do | ||
| let!(:federal_email_domain) { create(:federal_email_domain, name: 'gsa.gov') } | ||
|
|
||
| before do | ||
| allow(IdentityConfig.store).to receive(:use_fed_domain_class).and_return(true) | ||
| end | ||
|
|
||
| scenario 'User with valid fed email directed to recommend page and get to setup piv' do | ||
| user = create(:user, :with_phone, { email: 'example@gsa.gov' }) | ||
|
|
||
| visit new_user_session_path | ||
| fill_in_credentials_and_submit(user.email, user.password) | ||
| fill_in_code_with_last_phone_otp | ||
| click_submit_default | ||
| expect(page).to have_current_path(login_piv_cac_recommended_path) | ||
| click_button(t('two_factor_authentication.piv_cac_upsell.add_piv')) | ||
| expect(page).to have_current_path(setup_piv_cac_path) | ||
| end | ||
|
|
||
| scenario 'User with mil email directed to recommended PIV page and goes to add piv page' do | ||
| user = create(:user, :with_phone, { email: 'example@army.mil' }) | ||
|
|
||
| visit new_user_session_path | ||
| fill_in_credentials_and_submit(user.email, user.password) | ||
| fill_in_code_with_last_phone_otp | ||
| click_submit_default | ||
| expect(page).to have_current_path(login_piv_cac_recommended_path) | ||
| click_button(t('two_factor_authentication.piv_cac_upsell.add_piv')) | ||
| expect(page).to have_current_path(setup_piv_cac_path) | ||
| end | ||
|
|
||
| scenario 'User with fed email and skips recommendation page' do | ||
| user = create(:user, :with_phone, { email: 'example@gsa.gov' }) | ||
|
|
||
| visit new_user_session_path | ||
| fill_in_credentials_and_submit(user.email, user.password) | ||
| fill_in_code_with_last_phone_otp | ||
| click_submit_default | ||
| expect(page).to have_current_path(login_piv_cac_recommended_path) | ||
| click_button(t('two_factor_authentication.piv_cac_upsell.skip')) | ||
| expect(page).to have_current_path(account_path) | ||
| end | ||
|
|
||
| scenario 'User with mil email and skips recommendation page' do | ||
| user = create(:user, :with_phone, { email: 'example@army.mil' }) | ||
|
|
||
| visit new_user_session_path | ||
| fill_in_credentials_and_submit(user.email, user.password) | ||
| fill_in_code_with_last_phone_otp | ||
| click_submit_default | ||
| expect(page).to have_current_path(login_piv_cac_recommended_path) | ||
| click_button(t('two_factor_authentication.piv_cac_upsell.skip')) | ||
| expect(page).to have_current_path(account_path) | ||
| end | ||
|
|
||
| scenario 'User with invalid .gov email directed to account page' do | ||
| user = create(:user, :with_phone, { email: 'example@bad.gov' }) | ||
|
|
||
| visit new_user_session_path | ||
| fill_in_credentials_and_submit(user.email, user.password) | ||
| fill_in_code_with_last_phone_otp | ||
| click_submit_default | ||
| expect(page).to have_current_path(account_path) | ||
| end | ||
| let!(:federal_email_domain) { create(:federal_email_domain, name: 'gsa.gov') } | ||
|
|
||
| scenario 'User with valid fed email directed to recommend page and get to setup piv' do | ||
| user = create(:user, :with_phone, { email: 'example@gsa.gov' }) | ||
|
|
||
| visit new_user_session_path | ||
| fill_in_credentials_and_submit(user.email, user.password) | ||
| fill_in_code_with_last_phone_otp | ||
| click_submit_default | ||
| expect(page).to have_current_path(login_piv_cac_recommended_path) | ||
| click_button(t('two_factor_authentication.piv_cac_upsell.add_piv')) | ||
| expect(page).to have_current_path(setup_piv_cac_path) | ||
| end | ||
|
|
||
| context 'use_fed_domain_class set to false' do | ||
| before do | ||
| allow(IdentityConfig.store).to receive(:use_fed_domain_class).and_return(false) | ||
| end | ||
| scenario 'User with .gov email directed to recommend page and get to setup piv' do | ||
| user = create(:user, :with_phone, { email: 'example@good.gov' }) | ||
|
|
||
| visit new_user_session_path | ||
| fill_in_credentials_and_submit(user.email, user.password) | ||
| fill_in_code_with_last_phone_otp | ||
| click_submit_default | ||
| expect(page).to have_current_path(login_piv_cac_recommended_path) | ||
| click_button(t('two_factor_authentication.piv_cac_upsell.add_piv')) | ||
| expect(page).to have_current_path(setup_piv_cac_path) | ||
| end | ||
| scenario 'User with mil email directed to recommended PIV page and goes to add piv page' do | ||
| user = create(:user, :with_phone, { email: 'example@army.mil' }) | ||
|
|
||
| scenario 'User with .mil email directed to recommended PIV page and goes to add piv page' do | ||
| user = create(:user, :with_phone, { email: 'example@army.mil' }) | ||
|
|
||
| visit new_user_session_path | ||
| fill_in_credentials_and_submit(user.email, user.password) | ||
| fill_in_code_with_last_phone_otp | ||
| click_submit_default | ||
| expect(page).to have_current_path(login_piv_cac_recommended_path) | ||
| click_button(t('two_factor_authentication.piv_cac_upsell.add_piv')) | ||
| expect(page).to have_current_path(setup_piv_cac_path) | ||
| end | ||
| visit new_user_session_path | ||
| fill_in_credentials_and_submit(user.email, user.password) | ||
| fill_in_code_with_last_phone_otp | ||
| click_submit_default | ||
| expect(page).to have_current_path(login_piv_cac_recommended_path) | ||
| click_button(t('two_factor_authentication.piv_cac_upsell.add_piv')) | ||
| expect(page).to have_current_path(setup_piv_cac_path) | ||
| end | ||
|
|
||
| scenario 'User with fed email and skips recommendation page' do | ||
| user = create(:user, :with_phone, { email: 'example@example.gov' }) | ||
| scenario 'User with fed email and skips recommendation page' do | ||
| user = create(:user, :with_phone, { email: 'example@gsa.gov' }) | ||
|
|
||
| visit new_user_session_path | ||
| fill_in_credentials_and_submit(user.email, user.password) | ||
| fill_in_code_with_last_phone_otp | ||
| click_submit_default | ||
| expect(page).to have_current_path(login_piv_cac_recommended_path) | ||
| click_button(t('two_factor_authentication.piv_cac_upsell.skip')) | ||
| expect(page).to have_current_path(account_path) | ||
| end | ||
| visit new_user_session_path | ||
| fill_in_credentials_and_submit(user.email, user.password) | ||
| fill_in_code_with_last_phone_otp | ||
| click_submit_default | ||
| expect(page).to have_current_path(login_piv_cac_recommended_path) | ||
| click_button(t('two_factor_authentication.piv_cac_upsell.skip')) | ||
| expect(page).to have_current_path(account_path) | ||
| end | ||
|
|
||
| scenario 'User with mil email and skips recommendation page' do | ||
| user = create(:user, :with_phone, { email: 'example@army.mil' }) | ||
| scenario 'User with mil email and skips recommendation page' do | ||
| user = create(:user, :with_phone, { email: 'example@army.mil' }) | ||
|
|
||
| visit new_user_session_path | ||
| fill_in_credentials_and_submit(user.email, user.password) | ||
| fill_in_code_with_last_phone_otp | ||
| click_submit_default | ||
| expect(page).to have_current_path(login_piv_cac_recommended_path) | ||
| click_button(t('two_factor_authentication.piv_cac_upsell.skip')) | ||
| expect(page).to have_current_path(account_path) | ||
| end | ||
| visit new_user_session_path | ||
| fill_in_credentials_and_submit(user.email, user.password) | ||
| fill_in_code_with_last_phone_otp | ||
| click_submit_default | ||
| expect(page).to have_current_path(login_piv_cac_recommended_path) | ||
| click_button(t('two_factor_authentication.piv_cac_upsell.skip')) | ||
| expect(page).to have_current_path(account_path) | ||
| end | ||
|
|
||
| scenario 'User with invalid no .gov or .mil email directed to account page' do | ||
| user = create(:user, :with_phone, { email: 'example@bad.com' }) | ||
| scenario 'User with invalid .gov email directed to account page' do | ||
| user = create(:user, :with_phone, { email: 'example@bad.gov' }) | ||
|
|
||
| visit new_user_session_path | ||
| fill_in_credentials_and_submit(user.email, user.password) | ||
| fill_in_code_with_last_phone_otp | ||
| click_submit_default | ||
| expect(page).to have_current_path(account_path) | ||
| end | ||
| visit new_user_session_path | ||
| fill_in_credentials_and_submit(user.email, user.password) | ||
| fill_in_code_with_last_phone_otp | ||
| click_submit_default | ||
| expect(page).to have_current_path(account_path) | ||
| end | ||
| end |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.