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
4 changes: 3 additions & 1 deletion app/controllers/idv/how_to_verify_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,9 @@ def self.step_info
controller: self,
next_steps: [:hybrid_handoff, :document_capture],
preconditions: ->(idv_session:, user:) do
self.enabled? && idv_session.idv_consent_given
self.enabled? &&
idv_session.idv_consent_given &&
idv_session.service_provider&.in_person_proofing_enabled
end,
undo_step: ->(idv_session:, user:) { idv_session.skip_doc_auth = nil },
)
Expand Down
33 changes: 28 additions & 5 deletions spec/controllers/idv/how_to_verify_controller_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,9 @@
let(:ab_test_args) do
{ sample_bucket1: :sample_value1, sample_bucket2: :sample_value2 }
end
let(:service_provider) do
create(:service_provider, :active, :in_person_proofing_enabled)
end

before do
allow(IdentityConfig.store).to receive(:in_person_proofing_opt_in_enabled) { true }
Expand All @@ -14,6 +17,7 @@
stub_analytics
allow(@analytics).to receive(:track_event)
allow(subject).to receive(:ab_test_analytics_buckets).and_return(ab_test_args)
allow(subject.idv_session).to receive(:service_provider).and_return(service_provider)
subject.idv_session.welcome_visited = true
subject.idv_session.idv_consent_given = true
end
Expand Down Expand Up @@ -73,12 +77,29 @@
end

context 'when both ipp and opt-in ipp are enabled' do
it 'renders the show template for how to verify' do
get :show
context 'when the ServiceProvider has IPP enabled' do
it 'renders the show template for how to verify' do
get :show

expect(Idv::HowToVerifyController.enabled?).to be true
expect(subject.idv_session.service_provider.in_person_proofing_enabled).to be true
expect(subject.idv_session.skip_doc_auth).to be_nil
expect(response).to render_template :show
end
end

expect(Idv::HowToVerifyController.enabled?).to be true
expect(subject.idv_session.skip_doc_auth).to be_nil
expect(response).to render_template :show
context 'when the ServiceProvider has IPP disabled' do
let(:service_provider) do
create(:service_provider, :active)
end

it 'redirects to hybrid_handoff' do
get :show

expect(Idv::HowToVerifyController.enabled?).to be true
expect(subject.idv_session.service_provider.in_person_proofing_enabled).to be false
expect(response).to redirect_to(idv_hybrid_handoff_url)
end
end
end
end
Expand All @@ -94,6 +115,7 @@
irs_reproofing: false,
}.merge(ab_test_args)
end

it 'renders the show template' do
get :show

Expand Down Expand Up @@ -127,6 +149,7 @@
}
end
let(:analytics_name) { :idv_doc_auth_how_to_verify_submitted }

context 'no selection made' do
let(:analytics_args) do
{
Expand Down
4 changes: 4 additions & 0 deletions spec/factories/service_providers.rb
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,10 @@
active { true }
end

trait :in_person_proofing_enabled do
in_person_proofing_enabled { true }
end

trait :irs do
friendly_name { 'An IRS Service Provider' }
ial { 2 }
Expand Down
5 changes: 5 additions & 0 deletions spec/features/accessibility/idv_pages_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,10 @@
describe 'IDV pages' do
include IdvStepHelper

let(:service_provider) do
create(:service_provider, :active, :in_person_proofing_enabled)
end

scenario 'home page' do
sign_in_and_2fa_user

Expand All @@ -16,6 +20,7 @@
scenario 'how to verify page' do
allow(IdentityConfig.store).to receive(:in_person_proofing_enabled).and_return(true)
allow(IdentityConfig.store).to receive(:in_person_proofing_opt_in_enabled).and_return(true)
allow_any_instance_of(Idv::Session).to receive(:service_provider).and_return(service_provider)
sign_in_and_2fa_user

visit idv_welcome_url
Expand Down
178 changes: 137 additions & 41 deletions spec/features/idv/doc_auth/how_to_verify_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -4,83 +4,179 @@
include IdvHelper
include DocAuthHelper

let(:user) { user_with_2fa }
let(:ipp_service_provider) { create(:service_provider, :active, :in_person_proofing_enabled) }

context 'when ipp is enabled and opt-in ipp is disabled' do
before do
allow(IdentityConfig.store).to receive(:in_person_proofing_enabled) { true }
allow(IdentityConfig.store).to receive(:in_person_proofing_opt_in_enabled) { false }
context 'and when sp has opted into ipp' do
before do
allow(IdentityConfig.store).to receive(:in_person_proofing_enabled) { true }
allow(IdentityConfig.store).to receive(:in_person_proofing_opt_in_enabled) { false }
allow_any_instance_of(ServiceProvider).to receive(:in_person_proofing_enabled).
and_return(true)
sign_in_and_2fa_user(user, issuer: ipp_service_provider.issuer)

sign_in_and_2fa_user
complete_doc_auth_steps_before_agreement_step
complete_agreement_step
complete_doc_auth_steps_before_agreement_step
complete_agreement_step
end

it 'skips when disabled and redirects to hybrid handoff' do
expect(page).to have_current_path(idv_hybrid_handoff_url)
end
end

it 'skips when disabled and redirects to hybrid handoff' do
expect(page).to have_current_path(idv_hybrid_handoff_url)
context 'and when sp has not opted into ipp' do
before do
allow(IdentityConfig.store).to receive(:in_person_proofing_enabled) { true }
allow(IdentityConfig.store).to receive(:in_person_proofing_opt_in_enabled) { false }
allow_any_instance_of(ServiceProvider).to receive(:in_person_proofing_enabled).
and_return(false)
sign_in_and_2fa_user(user, issuer: ipp_service_provider.issuer)

complete_doc_auth_steps_before_agreement_step
complete_agreement_step
end

it 'skips when disabled and redirects to hybrid handoff' do
expect(page).to have_current_path(idv_hybrid_handoff_url)
end
end
end

context 'when ipp is disabled and opt-in ipp is enabled' do
before do
allow(IdentityConfig.store).to receive(:in_person_proofing_enabled) { false }
allow(IdentityConfig.store).to receive(:in_person_proofing_opt_in_enabled) { true }
context 'and when sp has opted into ipp' do
before do
allow(IdentityConfig.store).to receive(:in_person_proofing_enabled) { false }
allow(IdentityConfig.store).to receive(:in_person_proofing_opt_in_enabled) { true }
allow_any_instance_of(ServiceProvider).to receive(:in_person_proofing_enabled).
and_return(true)
sign_in_and_2fa_user(user, issuer: ipp_service_provider.issuer)

sign_in_and_2fa_user
complete_doc_auth_steps_before_agreement_step
complete_agreement_step
complete_doc_auth_steps_before_agreement_step
complete_agreement_step
end

it 'skips when disabled and redirects to hybrid handoff' do
expect(page).to have_current_path(idv_hybrid_handoff_url)
end
end

it 'skips when disabled and redirects to hybird handoff' do
expect(page).to have_current_path(idv_hybrid_handoff_url)
context 'and when sp has not opted into ipp' do
before do
allow(IdentityConfig.store).to receive(:in_person_proofing_enabled) { false }
allow(IdentityConfig.store).to receive(:in_person_proofing_opt_in_enabled) { true }
allow_any_instance_of(ServiceProvider).to receive(:in_person_proofing_enabled).
and_return(false)
sign_in_and_2fa_user(user, issuer: ipp_service_provider.issuer)

complete_doc_auth_steps_before_agreement_step
complete_agreement_step
end

it 'skips when disabled and redirects to hybrid handoff' do
expect(page).to have_current_path(idv_hybrid_handoff_url)
end
end
end

context 'when both ipp and opt-in ipp are disabled' do
before do
allow(IdentityConfig.store).to receive(:in_person_proofing_enabled) { false }
allow(IdentityConfig.store).to receive(:in_person_proofing_opt_in_enabled) { false }
context 'and when sp has opted into ipp' do
before do
allow(IdentityConfig.store).to receive(:in_person_proofing_enabled) { false }
allow(IdentityConfig.store).to receive(:in_person_proofing_opt_in_enabled) { false }
allow_any_instance_of(ServiceProvider).to receive(:in_person_proofing_enabled).
and_return(true)
sign_in_and_2fa_user(user, issuer: ipp_service_provider.issuer)

sign_in_and_2fa_user
complete_doc_auth_steps_before_agreement_step
complete_agreement_step
complete_doc_auth_steps_before_agreement_step
complete_agreement_step
end

it 'skips when disabled and redirects to hybrid handoff' do
expect(page).to have_current_path(idv_hybrid_handoff_url)
end
end

it 'skips when disabled and redirects to hybird handoff' do
expect(page).to have_current_path(idv_hybrid_handoff_url)
context 'and when sp has not opted into ipp' do
before do
allow(IdentityConfig.store).to receive(:in_person_proofing_enabled) { false }
allow(IdentityConfig.store).to receive(:in_person_proofing_opt_in_enabled) { false }
allow_any_instance_of(ServiceProvider).to receive(:in_person_proofing_enabled).
and_return(false)
sign_in_and_2fa_user(user, issuer: ipp_service_provider.issuer)

complete_doc_auth_steps_before_agreement_step
complete_agreement_step
end

it 'skips when disabled and redirects to hybrid handoff' do
expect(page).to have_current_path(idv_hybrid_handoff_url)
end
end
end

context 'when both ipp and opt-in ipp are enabled' do
before do
allow(IdentityConfig.store).to receive(:in_person_proofing_enabled) { true }
allow(IdentityConfig.store).to receive(:in_person_proofing_opt_in_enabled) { true }
context 'and when sp has opted into ipp' do
before do
allow(IdentityConfig.store).to receive(:in_person_proofing_enabled) { true }
allow(IdentityConfig.store).to receive(:in_person_proofing_opt_in_enabled) { true }
allow_any_instance_of(ServiceProvider).to receive(:in_person_proofing_enabled).
and_return(true)

sign_in_and_2fa_user
complete_doc_auth_steps_before_agreement_step
complete_agreement_step
end
sign_in_and_2fa_user(user, issuer: ipp_service_provider.issuer)
complete_doc_auth_steps_before_agreement_step
complete_agreement_step
end

it 'displays expected content and requires a choice' do
expect(page).to have_current_path(idv_how_to_verify_path)

# Try to continue without an option
click_continue

expect(page).to have_current_path(idv_how_to_verify_path)
expect(page).to have_content(t('errors.doc_auth.how_to_verify_form'))

it 'displays expected content and requires a choice' do
expect(page).to have_current_path(idv_how_to_verify_path)
complete_how_to_verify_step(remote: true)
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

we should add another step where remote is false. Perhaps instead of an additional test we can go back after line 141 and then redo w/ remote = false

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.

Good catch, and thanks for suggesting a much easier option than I would have thought of. 👼

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

thanks for adding this additional test!

expect(page).to have_current_path(idv_hybrid_handoff_url)

# go back and also test remote: false case
page.go_back
complete_how_to_verify_step(remote: false)
expect(page).to have_current_path(idv_document_capture_path)
end
end

# Try to continue without an option
click_continue
context 'and when sp has not opted into ipp' do
before do
allow(IdentityConfig.store).to receive(:in_person_proofing_enabled) { true }
allow(IdentityConfig.store).to receive(:in_person_proofing_opt_in_enabled) { true }
allow_any_instance_of(ServiceProvider).to receive(:in_person_proofing_enabled).
and_return(false)

expect(page).to have_current_path(idv_how_to_verify_path)
expect(page).to have_content(t('errors.doc_auth.how_to_verify_form'))
sign_in_and_2fa_user(user, issuer: ipp_service_provider.issuer)
complete_doc_auth_steps_before_agreement_step
complete_agreement_step
end

complete_how_to_verify_step(remote: true)
expect(page).to have_current_path(idv_hybrid_handoff_url)
it 'skips when disabled and redirects to hybrid handoff' do
expect(page).to have_current_path(idv_hybrid_handoff_url)
end
end
end

describe 'navigating to How To Verify from Agreement page in 50/50 state' do
describe 'navigating to How To Verify from Agreement page in 50/50 state
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

do we need to mock opt in enabled for the service_provider for this spec?

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.

I didn't realize this when we were discussing this on a call, but we have this covered further below. We test it both ways: 171-172 tests the opt-in provider case, and then further down on 180 we test with the opt-in feature flag disabled.

when the sp has opted into ipp' do
let(:user) { user_with_2fa }
before do
allow(IdentityConfig.store).to receive(:in_person_proofing_enabled) { true }
allow(IdentityConfig.store).to receive(:in_person_proofing_opt_in_enabled) {
initial_opt_in_enabled
}
allow_any_instance_of(ServiceProvider).to receive(:in_person_proofing_enabled).
and_return(true)

sign_in_and_2fa_user
sign_in_and_2fa_user(user, issuer: ipp_service_provider.issuer)
complete_doc_auth_steps_before_agreement_step
complete_agreement_step
end
Expand Down
Loading