Skip to content
Merged
Show file tree
Hide file tree
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
2 changes: 1 addition & 1 deletion spec/features/idv/analytics_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -278,7 +278,7 @@
complete_review_step(user)
acknowledge_and_confirm_personal_key
visit_help_center
visit_sp
visit_sp_from_in_person_ready_to_verify
end

it 'records all of the events', allow_browser_log: true do
Expand Down
74 changes: 66 additions & 8 deletions spec/features/idv/end_to_end_idv_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -2,16 +2,13 @@

RSpec.describe 'Identity verification', :js do
include IdvStepHelper
include InPersonHelper

# Needed specs:
# unsupervised proofing happy path mobile only
# hybrid mobile end to end (edit hybrid_mobile_spec)
# verify by mail
# in person proofing
let(:sp) { :oidc }

scenario 'Unsupervised proofing happy path desktop' do
try_to_skip_ahead_before_signing_in
visit_idp_from_sp_with_ial2(:oidc)
visit_idp_from_sp_with_ial2(sp)
user = sign_up_and_2fa_ial1_user

validate_welcome_page
Expand Down Expand Up @@ -50,12 +47,67 @@
validate_personal_key_page
acknowledge_and_confirm_personal_key

validate_idv_completed_page
validate_idv_completed_page(user)
click_agree_and_continue

validate_return_to_sp
end

context 'with an sp that allows in person proofing' do
before do
allow(IdentityConfig.store).to receive(:in_person_proofing_enabled).and_return(true)

ServiceProvider.find_by(issuer: service_provider_issuer(sp)).
update(in_person_proofing_enabled: true)
end

scenario 'In person proofing verify by mail', allow_browser_log: true do
visit_idp_from_sp_with_ial2(sp)
user = sign_up_and_2fa_ial1_user

begin_in_person_proofing
complete_all_in_person_proofing_steps(user)

enter_gpo_flow
gpo_step

complete_review_step(user)

validate_come_back_later_page
complete_come_back_later
validate_return_to_sp

visit sign_out_url
user.reload

visit_idp_from_sp_with_ial2(sp)

sign_in_live_with_2fa(user)

complete_gpo_verification(user)
expect(user.identity_verified?).to be(false)

acknowledge_and_confirm_personal_key

expect(page).to have_current_path(idv_in_person_ready_to_verify_path)
visit_sp_from_in_person_ready_to_verify

visit sign_out_url
user.reload

mark_in_person_enrollment_passed(user)

# sign in
visit_idp_from_sp_with_ial2(sp)
sign_in_live_with_2fa(user)

validate_idv_completed_page(user)
click_agree_and_continue

validate_return_to_sp
end
end

def validate_welcome_page
expect(page).to have_current_path(idv_welcome_path)

Expand Down Expand Up @@ -220,12 +272,18 @@ def validate_review_submit(user)
expect(GpoConfirmation.count).to eq(0)
end

def validate_come_back_later_page
expect(page).to have_current_path(idv_come_back_later_path)
expect_in_person_gpo_step_indicator_current_step(t('step_indicator.flows.idv.get_a_letter'))
end

def validate_personal_key_page
expect(current_path).to eq idv_personal_key_path
expect(page).to have_content(t('forms.personal_key_partial.acknowledgement.header'))
end

def validate_idv_completed_page
def validate_idv_completed_page(user)
expect(user.identity_verified?).to be(true)
expect(current_path).to eq sign_up_completed_path
expect(page).to have_content t(
'titles.sign_up.completion_ial2',
Expand Down
16 changes: 2 additions & 14 deletions spec/features/idv/steps/gpo_step_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -27,14 +27,6 @@

context 'the user has sent a letter but not verified an OTP' do
let(:user) { user_with_2fa }
let(:otp) { 'ABC123' }
let(:gpo_confirmation_code) do
create(
:gpo_confirmation_code,
profile: User.find(user.id).pending_profile,
otp_fingerprint: Pii::Fingerprinter.fingerprint(otp),
)
end

it 'allows the user to resend a letter and redirects to the come back later step', :js do
complete_idv_and_return_to_gpo_step
Expand Down Expand Up @@ -64,9 +56,7 @@
expect(page).to have_current_path(idv_gpo_verify_path)

# complete verification: end to end gpo test
gpo_confirmation_code
fill_in t('forms.verify_profile.name'), with: otp
click_button t('forms.verify_profile.submit')
complete_gpo_verification(user)

expect(user.identity_verified?).to be(true)

Expand All @@ -77,14 +67,12 @@
it 'does not 500' do
create(:profile, :with_pii, user: user, gpo_verification_pending_at: 1.day.ago)
create(:piv_cac_configuration, user: user, x509_dn_uuid: 'helloworld', name: 'My PIV Card')
gpo_confirmation_code

signin_with_piv(user)
fill_in t('account.index.password'), with: user.password
click_button t('forms.buttons.submit.default')

fill_in t('forms.verify_profile.name'), with: otp
click_button t('forms.verify_profile.submit')
complete_gpo_verification(user)

expect(user.identity_verified?).to be(true)

Expand Down
16 changes: 16 additions & 0 deletions spec/support/features/doc_auth_helper.rb
Original file line number Diff line number Diff line change
Expand Up @@ -149,6 +149,22 @@ def complete_doc_auth_steps_before_link_sent_step
click_send_link
end

def complete_gpo_verification(user)
otp = 'ABC123'
create(
:gpo_confirmation_code,
profile: User.find(user.id).pending_profile,
otp_fingerprint: Pii::Fingerprinter.fingerprint(otp),
)
fill_in t('forms.verify_profile.name'), with: otp
click_button t('forms.verify_profile.submit')
end

def complete_come_back_later
# Exit Login.gov and return to SP
click_on t('idv.cancel.actions.exit', app_name: APP_NAME)
end

def complete_all_doc_auth_steps(expect_accessible: false)
complete_doc_auth_steps_before_verify_step(expect_accessible: expect_accessible)
complete_verify_step
Expand Down
6 changes: 3 additions & 3 deletions spec/support/features/idv_step_helper.rb
Original file line number Diff line number Diff line change
Expand Up @@ -64,8 +64,8 @@ def click_what_to_bring_link
click_link t('in_person_proofing.body.barcode.learn_more')
end

def visit_sp
click_sp_link
def visit_sp_from_in_person_ready_to_verify
click_sp_link_in_person_ready_to_verify
end

def sp_friendly_name
Expand All @@ -76,7 +76,7 @@ def link_text
t('in_person_proofing.body.barcode.return_to_partner_link', sp_name: sp_friendly_name)
end

def click_sp_link
def click_sp_link_in_person_ready_to_verify
expect(page).to have_content(sp_text)
click_link(link_text)
end
Expand Down
7 changes: 7 additions & 0 deletions spec/support/features/in_person_helper.rb
Original file line number Diff line number Diff line change
Expand Up @@ -220,4 +220,11 @@ def make_pii(same_address_as_id: 'true')
pii_from_user[:state] = state
pii_from_user[:zipcode] = zipcode
end

def mark_in_person_enrollment_passed(user)
enrollment = user.in_person_enrollments.last
expect(enrollment).to_not be_nil
enrollment.profile.activate_after_passing_in_person
enrollment.update(status: :passed)
end
end
5 changes: 3 additions & 2 deletions spec/support/features/session_helper.rb
Original file line number Diff line number Diff line change
Expand Up @@ -158,8 +158,9 @@ def begin_sign_up_with_sp_and_ial(ial2:)

def sign_up_and_set_password
user = sign_up
fill_in t('forms.password'), with: VALID_PASSWORD
fill_in t('components.password_confirmation.confirm_label'), with: VALID_PASSWORD
user.password = VALID_PASSWORD
Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Setting this here so that sign_in_live_with_2fa(user) is successful after signing out. This helper is used all over, so wondering if this might hide issues in the future.

fill_in t('forms.password'), with: user.password
fill_in t('components.password_confirmation.confirm_label'), with: user.password
click_button t('forms.buttons.continue')
user
end
Expand Down
6 changes: 1 addition & 5 deletions spec/support/sp_auth_helper.rb
Original file line number Diff line number Diff line change
Expand Up @@ -54,11 +54,7 @@ def create_in_person_ial2_account_go_back_to_sp_and_sign_out(sp)
visit sign_out_url
user.reload

# Mark IPP as passed
enrollment = user.in_person_enrollments.last
expect(enrollment).to_not be_nil
enrollment.profile.activate_after_passing_in_person
enrollment.update(status: :passed)
mark_in_person_enrollment_passed(user)

visit_idp_from_sp_with_ial2(sp)

Expand Down