-
Notifications
You must be signed in to change notification settings - Fork 166
Don't check attempt count on success step #2246
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -8,70 +8,97 @@ | |
| before do | ||
| start_idv_from_sp(sp) | ||
| complete_idv_steps_before_step(step, user) | ||
| if step == :profile | ||
| perfom_maximum_allowed_idv_step_attempts { fill_out_idv_form_fail } | ||
| elsif step == :phone | ||
| perfom_maximum_allowed_idv_step_attempts { fill_out_phone_form_fail } | ||
| end | ||
| end | ||
|
|
||
| scenario 'more than 3 attempts in 24 hours prevents further attempts' do | ||
| # Blocked if visiting verify directly | ||
| visit idv_url | ||
| advance_to_phone_step if step == :phone | ||
| expect_user_to_be_unable_to_perform_idv(sp) | ||
| context 'after completing the max number of attempts' do | ||
| before do | ||
| if step == :profile | ||
| perfom_maximum_allowed_idv_step_attempts { fill_out_idv_form_fail } | ||
| elsif step == :phone | ||
| perfom_maximum_allowed_idv_step_attempts { fill_out_phone_form_fail } | ||
| end | ||
| end | ||
|
|
||
| # Blocked if visiting from an SP | ||
| visit_idp_from_sp_with_loa3(:oidc) | ||
| advance_to_phone_step if step == :phone | ||
| expect_user_to_be_unable_to_perform_idv(sp) | ||
| scenario 'more than 3 attempts in 24 hours prevents further attempts' do | ||
| # Blocked if visiting verify directly | ||
| visit idv_url | ||
| advance_to_phone_step if step == :phone | ||
| expect_user_to_be_unable_to_perform_idv(sp) | ||
|
|
||
| if step == :sessions | ||
| user.reload | ||
| # Blocked if visiting from an SP | ||
| visit_idp_from_sp_with_loa3(:oidc) | ||
| advance_to_phone_step if step == :phone | ||
| expect_user_to_be_unable_to_perform_idv(sp) | ||
|
|
||
| expect(user.idv_attempted_at).to_not be_nil | ||
| if step == :sessions | ||
| user.reload | ||
|
|
||
| expect(user.idv_attempted_at).to_not be_nil | ||
| end | ||
| end | ||
| end | ||
|
|
||
| scenario 'after 24 hours the user can retry and complete idv' do | ||
| visit account_path | ||
| first(:link, t('links.sign_out')).click | ||
| reattempt_interval = (Figaro.env.idv_attempt_window_in_hours.to_i + 1).hours | ||
| scenario 'after 24 hours the user can retry and complete idv' do | ||
| visit account_path | ||
| first(:link, t('links.sign_out')).click | ||
| reattempt_interval = (Figaro.env.idv_attempt_window_in_hours.to_i + 1).hours | ||
|
|
||
| Timecop.travel reattempt_interval do | ||
| visit_idp_from_sp_with_loa3(:oidc) | ||
| click_link t('links.sign_in') | ||
| sign_in_live_with_2fa(user) | ||
| Timecop.travel reattempt_interval do | ||
| visit_idp_from_sp_with_loa3(:oidc) | ||
| click_link t('links.sign_in') | ||
| sign_in_live_with_2fa(user) | ||
|
|
||
| expect(page).to_not have_content(t("idv.modal.#{step_locale_key}.heading")) | ||
| expect(current_url).to eq(idv_jurisdiction_url) | ||
| expect(page).to_not have_content(t("idv.modal.#{step_locale_key}.heading")) | ||
| expect(current_url).to eq(idv_jurisdiction_url) | ||
|
|
||
| fill_out_idv_jurisdiction_ok | ||
| click_idv_continue | ||
| complete_idv_profile_ok(user) | ||
| click_acknowledge_personal_key | ||
| click_idv_continue | ||
| fill_out_idv_jurisdiction_ok | ||
| click_idv_continue | ||
| complete_idv_profile_ok(user) | ||
| click_acknowledge_personal_key | ||
| click_idv_continue | ||
|
|
||
| expect(current_url).to start_with('http://localhost:7654/auth/result') | ||
| expect(current_url).to start_with('http://localhost:7654/auth/result') | ||
| end | ||
| end | ||
| end | ||
|
|
||
| scenario 'user sees failure flash message' do | ||
| expect(page).to have_css('.alert-error', text: t("idv.modal.#{step_locale_key}.heading")) | ||
| expect(page).to have_css( | ||
| '.alert-error', | ||
| text: strip_tags(t("idv.modal.#{step_locale_key}.fail")) | ||
| ) | ||
| end | ||
|
|
||
| context 'with js', :js do | ||
| scenario 'user sees the failure modal' do | ||
| expect(page).to have_css('.modal-fail', text: t("idv.modal.#{step_locale_key}.heading")) | ||
| scenario 'user sees failure flash message' do | ||
| expect(page).to have_css('.alert-error', text: t("idv.modal.#{step_locale_key}.heading")) | ||
| expect(page).to have_css( | ||
| '.modal-fail', | ||
| '.alert-error', | ||
| text: strip_tags(t("idv.modal.#{step_locale_key}.fail")) | ||
| ) | ||
| end | ||
|
|
||
| context 'with js', :js do | ||
| scenario 'user sees the failure modal' do | ||
| expect(page).to have_css('.modal-fail', text: t("idv.modal.#{step_locale_key}.heading")) | ||
| expect(page).to have_css( | ||
| '.modal-fail', | ||
| text: strip_tags(t("idv.modal.#{step_locale_key}.fail")) | ||
| ) | ||
| end | ||
| end | ||
| end | ||
|
|
||
| context 'after completing one less than the max attempts' do | ||
| it 'allows the user to continue if their last attempt is successful' do | ||
|
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. A little restructuring here, but this is the only new test. |
||
| max_attempts_less_one.times do | ||
| fill_out_idv_form_fail if step == :profile | ||
| fill_out_phone_form_fail if step == :phone | ||
| click_continue | ||
| end | ||
|
|
||
| fill_out_idv_form_ok if step == :profile | ||
| fill_out_phone_form_ok if step == :phone | ||
| click_continue | ||
|
|
||
| if step == :profile | ||
| expect(page).to have_content(t('idv.titles.session.success')) | ||
| expect(page).to have_current_path(idv_session_success_path) | ||
| elsif step == :phone | ||
| expect(page).to have_content(t('idv.titles.otp_delivery_method')) | ||
| expect(page).to have_current_path(idv_otp_delivery_method_path) | ||
| end | ||
| end | ||
| end | ||
|
|
||
| def perfom_maximum_allowed_idv_step_attempts | ||
|
|
||
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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is an ugly diff. I didn't change anything here, just added indentation