Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
26 commits
Select commit Hold shift + click to select a range
5e3c9a9
LG-9072 Update state ID workflows
gina-yamada Apr 26, 2023
b80cc7a
LG-9072 Add testing for workflow updates
gina-yamada Apr 26, 2023
c009405
LG-9072 Fix lint issues
gina-yamada Apr 26, 2023
6d21332
LG-9072 Fix lint issues
gina-yamada Apr 26, 2023
e1f4539
LG-9072 Fix link issues
gina-yamada Apr 26, 2023
303d424
LG-9072 Fix lint issues
gina-yamada Apr 26, 2023
21f79e2
Merge branch 'main' of github.com:18F/identity-idp into gina/lg-9072-…
gina-yamada Apr 26, 2023
f3933ff
LG-9072 Update all instance of state_id_... I introduced.
gina-yamada Apr 27, 2023
24379db
changelog: Upcoming Features, In-person proofing, Applicant verify yo…
gina-yamada Apr 27, 2023
9d0c7ae
LG-9072 Updates from var name changes
gina-yamada Apr 27, 2023
661087a
LG-9072 Removed unnecessary change and testing
gina-yamada Apr 27, 2023
001a166
LG-9072 Update what I am eval to hit clearing addr
gina-yamada Apr 27, 2023
37302c1
Merge branch 'main' of github.com:18F/identity-idp into gina/lg-9072-…
gina-yamada Apr 27, 2023
dc3c7bf
LG-9072 update text
gina-yamada Apr 27, 2023
1800007
LG-9072 Use helper to set variable, del unused var
gina-yamada Apr 28, 2023
a9827da
LG-9072 Use helper to set var, move comments
gina-yamada Apr 28, 2023
6ff7329
LG-9072 update comments
gina-yamada Apr 28, 2023
f44a31b
LG-9072 tests for flow and updates
gina-yamada Apr 28, 2023
b5a8342
LG-9072 Combine specs with existing describe block
gina-yamada May 1, 2023
3fc24a3
LG-9072 Remove unnecessary setup code
gina-yamada May 1, 2023
692590d
LG-9072 Combine call specs
gina-yamada May 1, 2023
f616a4f
LG-9072 Use helper methods, lint
gina-yamada May 1, 2023
ddf57dd
Merge branch 'main' of github.com:18F/identity-idp into gina/lg-9072-…
gina-yamada May 1, 2023
608dc45
LG-9072 Remove but & and from test descriptions
gina-yamada May 1, 2023
5b66b8a
LG-9072 Add more tests, linter
gina-yamada May 2, 2023
aca81eb
Merge branch 'main' of github.com:18F/identity-idp into gina/lg-9072-…
gina-yamada May 2, 2023
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
36 changes: 29 additions & 7 deletions app/services/idv/steps/in_person/state_id_step.rb
Original file line number Diff line number Diff line change
Expand Up @@ -14,19 +14,25 @@ def self.analytics_submitted_event

def call
pii_from_user = flow_session[:pii_from_user]
initial_state_of_same_address_as_id = flow_session[:pii_from_user][:same_address_as_id]
Idv::StateIdForm::ATTRIBUTES.each do |attr|
flow_session[:pii_from_user][attr] = flow_params[attr]
end
# Accept Date of Birth from both memorable date and input date components
formatted_dob = MemorableDateComponent.extract_date_param flow_params&.[](:dob)
pii_from_user[:dob] = formatted_dob if formatted_dob
if capture_secondary_id_enabled? && pii_from_user[:same_address_as_id] == 'true'
pii_from_user[:address1] = flow_params[:identity_doc_address1]
pii_from_user[:address2] = flow_params[:identity_doc_address2]
pii_from_user[:city] = flow_params[:identity_doc_city]
pii_from_user[:state] = flow_params[:identity_doc_address_state]
pii_from_user[:zipcode] = flow_params[:identity_doc_zipcode]
mark_step_complete(:address)

if capture_secondary_id_enabled?
if pii_from_user[:same_address_as_id] == 'true'
copy_state_id_address_to_residential_address(pii_from_user)
mark_step_complete(:address)
end

if initial_state_of_same_address_as_id == 'true' &&
pii_from_user[:same_address_as_id] == 'false'
clear_residential_address(pii_from_user)
mark_step_incomplete(:address)
end
end
end

Expand All @@ -46,6 +52,22 @@ def capture_secondary_id_enabled?
current_user.establishing_in_person_enrollment.capture_secondary_id_enabled
end

def clear_residential_address(pii_from_user)
pii_from_user.delete(:address1)
pii_from_user.delete(:address2)
pii_from_user.delete(:city)
pii_from_user.delete(:state)
pii_from_user.delete(:zipcode)
end

def copy_state_id_address_to_residential_address(pii_from_user)
pii_from_user[:address1] = flow_params[:identity_doc_address1]
pii_from_user[:address2] = flow_params[:identity_doc_address2]
pii_from_user[:city] = flow_params[:identity_doc_city]
pii_from_user[:state] = flow_params[:identity_doc_address_state]
pii_from_user[:zipcode] = flow_params[:identity_doc_zipcode]
end

def updating_state_id
flow_session[:pii_from_user].has_key?(:first_name)
end
Expand Down
154 changes: 154 additions & 0 deletions spec/features/idv/in_person_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -688,4 +688,158 @@
expect(page).to have_content(t('headings.verify'))
end
end

context 'in_person_capture_secondary_id_enabled feature flag enabled and' do
context 'when updates are made on state ID page starting from Verify Your Information',
allow_browser_log: true do
let(:user) { user_with_2fa }

before(:each) do
allow(IdentityConfig.store).to receive(:in_person_capture_secondary_id_enabled).
and_return(true)

sign_in_and_2fa_user(user)
begin_in_person_proofing(user)
complete_location_step(user)
complete_prepare_step(user)
end

it 'does not update their previous selection of "Yes,
I live at the address on my state-issued ID"' do
complete_state_id_step(user, same_address_as_id: true, double_address_verification: true)
# skip address step
complete_ssn_step(user)
# expect to be on verify page
expect(page).to have_content(t('headings.verify'))
expect(page).to have_current_path(idv_in_person_step_url(step: :verify))
# click update state ID button on the verify page
click_button t('idv.buttons.change_state_id_label')
# expect to be on the state ID page
expect(page).to have_content(t('in_person_proofing.headings.update_state_id'))
# change address
fill_in t('in_person_proofing.form.state_id.address1'), with: ''
fill_in t('in_person_proofing.form.state_id.address1'), with: 'test update address'
click_button t('forms.buttons.submit.update')
# expect to be back on verify page
expect(page).to have_content(t('headings.verify'))
expect(page).to have_current_path(idv_in_person_step_url(step: :verify))
expect(page).to have_content(t('headings.verify'))
# expect to see state ID address update on verify twice
expect(page).to have_text('test update address').twice # for state id addr and addr update
# click update state id address
click_button t('idv.buttons.change_state_id_label')
# expect to be on the state ID page
expect(page).to have_content(t('in_person_proofing.headings.update_state_id'))
# expect "Yes, I live at a different address" is checked"
expect(page).to have_checked_field(
t('in_person_proofing.form.state_id.same_address_as_id_yes'),
visible: false,
)
end

it 'does not update their previous selection of "No, I live at a different address"' do
complete_state_id_step(user, same_address_as_id: false, double_address_verification: true)
# expect to be on address page
expect(page).to have_content(t('in_person_proofing.headings.address'))
# complete address step
complete_address_step(user, double_address_verification: true)
complete_ssn_step(user)
# expect to be back on verify page
expect(page).to have_content(t('headings.verify'))
expect(page).to have_current_path(idv_in_person_step_url(step: :verify))
# click update state ID button on the verify page
click_button t('idv.buttons.change_state_id_label')
# expect to be on the state ID page
expect(page).to have_content(t('in_person_proofing.headings.update_state_id'))
# change address
fill_in t('in_person_proofing.form.state_id.address1'), with: ''
fill_in t('in_person_proofing.form.state_id.address1'), with: 'test update address'
click_button t('forms.buttons.submit.update')
# expect to be back on verify page
expect(page).to have_content(t('headings.verify'))
expect(page).to have_current_path(idv_in_person_step_url(step: :verify))
expect(page).to have_content(t('headings.verify'))
# expect to see state ID address update on verify
expect(page).to have_text('test update address').once # only state id address update
# click update state id address
click_button t('idv.buttons.change_state_id_label')
# expect to be on the state ID page
expect(page).to have_content(t('in_person_proofing.headings.update_state_id'))
expect(page).to have_checked_field(
t('in_person_proofing.form.state_id.same_address_as_id_no'),
visible: false,
)
end

it 'updates their previous selection from "Yes" TO "No, I live at a different address"' do
complete_state_id_step(user, same_address_as_id: true, double_address_verification: true)
# skip address step
complete_ssn_step(user)
# click update state ID button on the verify page
click_button t('idv.buttons.change_state_id_label')
# expect to be on the state ID page
expect(page).to have_content(t('in_person_proofing.headings.update_state_id'))
# change address
fill_in t('in_person_proofing.form.state_id.address1'), with: ''
fill_in t('in_person_proofing.form.state_id.address1'), with: 'test update address'
# change response to No
choose t('in_person_proofing.form.state_id.same_address_as_id_no')
click_button t('forms.buttons.submit.update')
# expect to be on address page
expect(page).to have_content(t('in_person_proofing.headings.address'))
# complete address step
complete_address_step(user, double_address_verification: true)
# expect to be on verify page
expect(page).to have_content(t('headings.verify'))
expect(page).to have_current_path(idv_in_person_step_url(step: :verify))
# expect to see state ID address update on verify
expect(page).to have_text('test update address').once # only state id address update
# click update state id address
click_button t('idv.buttons.change_state_id_label')
# expect to be on the state ID page
expect(page).to have_content(t('in_person_proofing.headings.update_state_id'))
# check that the "No, I live at a different address" is checked"
expect(page).to have_checked_field(
t('in_person_proofing.form.state_id.same_address_as_id_no'),
visible: false,
)
end

it 'updates their previous selection from "No" TO "Yes,
I live at the address on my state-issued ID"' do
complete_state_id_step(user, same_address_as_id: false, double_address_verification: true)
# expect to be on address page
expect(page).to have_content(t('in_person_proofing.headings.address'))
# complete address step
complete_address_step(user, double_address_verification: true)
complete_ssn_step(user)
# expect to be on verify page
expect(page).to have_content(t('headings.verify'))
expect(page).to have_current_path(idv_in_person_step_url(step: :verify))
# click update state ID button on the verify page
click_button t('idv.buttons.change_state_id_label')
# expect to be on the state ID page
expect(page).to have_content(t('in_person_proofing.headings.update_state_id'))
# change address
fill_in t('in_person_proofing.form.state_id.address1'), with: ''
fill_in t('in_person_proofing.form.state_id.address1'), with: 'test update address'
# change response to Yes
choose t('in_person_proofing.form.state_id.same_address_as_id_yes')
click_button t('forms.buttons.submit.update')
# expect to be back on verify page
expect(page).to have_content(t('headings.verify'))
expect(page).to have_current_path(idv_in_person_step_url(step: :verify))
# expect to see state ID address update on verify twice
expect(page).to have_text('test update address').twice # for state id addr and addr update
# click update state ID button on the verify page
click_button t('idv.buttons.change_state_id_label')
# expect to be on the state ID page
expect(page).to have_content(t('in_person_proofing.headings.update_state_id'))
expect(page).to have_checked_field(
t('in_person_proofing.form.state_id.same_address_as_id_yes'),
visible: false,
)
end
end
end
end
15 changes: 14 additions & 1 deletion spec/services/idv/steps/in_person/address_step_spec.rb
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
require 'rails_helper'

describe Idv::Steps::InPerson::AddressStep do
include InPersonHelper
let(:submitted_values) { {} }
let(:pii_from_user) { flow.flow_session[:pii_from_user] }
let(:params) { ActionController::Parameters.new({ in_person_address: submitted_values }) }
Expand Down Expand Up @@ -115,7 +116,7 @@
let(:params) { ActionController::Parameters.new }

context 'address1 is set' do
it 'returns extra view variables' do
it 'returns extra view variables and updating_address is true' do
pii_from_user[:address1] = address1

expect(step.extra_view_variables).to include(
Expand All @@ -127,6 +128,18 @@
end
end

context 'address1 is not set' do
it 'does not return extra view variables and updating_address is false' do
expect(step.extra_view_variables[:pii]).not_to include(
address1:,
)

expect(step.extra_view_variables).to include(
updating_address: false,
)
end
end

it 'returns capture enabled = false' do
expect(step.extra_view_variables).to include(
capture_secondary_id_enabled: false,
Expand Down
Loading