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
11 changes: 6 additions & 5 deletions knapsack_rspec_report.json
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,7 @@
"spec/forms/idv/ssn_form_spec.rb": 0.1248829999967711,
"spec/components/vendor_outage_alert_component_spec.rb": 0.034957999996549916,
"spec/views/idv/phone/new.html.erb_spec.rb": 0.06148799999937182,
"spec/lib/feature_management_spec.rb": 0.27332799999567214,
"spec/lib/identity_job_log_subscriber_spec.rb": 0.16019000000233063,
"spec/forms/gpo_verify_form_spec.rb": 0.25047999999515014,
"spec/services/push_notification/email_changed_event_spec.rb": 0.022557999996934086,
Expand Down Expand Up @@ -193,7 +194,7 @@
"spec/lib/analytics_events_documenter_spec.rb": 0.1543309999979101,
"spec/services/proofing/aamva/response/verification_response_spec.rb": 0.1954249999980675,
"spec/services/agreements/reports/agency_partner_accounts_report_spec.rb": 0.03952299999946263,
"spec/features/idv/analytics_spec.rb": 21.609241000005568,
"spec/features/idv/analytics_spec.rb": 38.083291000002646,
"spec/presenters/two_factor_authentication/personal_key_selection_presenter_spec.rb": 0.004340999999840278,
"spec/controllers/health/health_controller_spec.rb": 0.019761000003200024,
"spec/features/idv/doc_capture/document_capture_step_spec.rb": 110.0928899999999,
Expand Down Expand Up @@ -345,7 +346,7 @@
"spec/services/personal_key_generator_spec.rb": 0.3026769999996759,
"spec/views/two_factor_authentication/sms_opt_in/new.html.erb_spec.rb": 0.06462499999906868,
"spec/views/devise/shared/_password_strength.html.erb_spec.rb": 0.0479399999967427,
"spec/features/idv/steps/confirmation_step_spec.rb": 128.83288399999583,
"spec/features/idv/steps/confirmation_step_spec.rb": 155.54028299999482,
"spec/services/db/deleted_user/create_spec.rb": 0.07442100000480423,
"spec/controllers/test/telephony_controller_spec.rb": 0.025112000002991408,
"spec/controllers/frontend_log_controller_spec.rb": 0.18439500000386033,
Expand Down Expand Up @@ -406,7 +407,7 @@
"spec/features/idv/sp_handoff_spec.rb": 107.38864300000569,
"spec/routing/gpo_verification_routing_spec.rb": 0.7558229999995092,
"spec/features/visitors/js_disabled_spec.rb": 8.520698000000266,
"spec/features/idv/steps/review_step_spec.rb": 61.3108210000064,
"spec/features/idv/steps/review_step_spec.rb": 63.121782000001986,
"spec/services/data_requests/create_email_addresses_report_spec.rb": 0.020833000002312474,
"spec/forms/api/profile_creation_form_spec.rb": 0.7231019999962882,
"spec/forms/new_phone_form_spec.rb": 0.7517710000029183,
Expand Down Expand Up @@ -783,7 +784,7 @@
"spec/models/sp_return_log_spec.rb": 0.005828000001201872,
"spec/views/idv/phone_errors/warning.html.erb_spec.rb": 0.047647999999753665,
"spec/features/two_factor_authentication/change_factor_spec.rb": 23.08214399999997,
"spec/features/idv/steps/forgot_password_step_spec.rb": 46.1194669999968,
"spec/features/idv/steps/forgot_password_step_spec.rb": 33.54180800000904,
"spec/lib/headers_filter_spec.rb": 0.007020999997621402,
"spec/views/devise/sessions/new.html.erb_spec.rb": 0.2999290000007022,
"spec/views/idv/doc_auth/welcome.html.erb_spec.rb": 0.11305600000196137,
Expand Down Expand Up @@ -826,7 +827,7 @@
"spec/models/service_provider_spec.rb": 0.06330100000195671,
"spec/controllers/openid_connect/user_info_controller_spec.rb": 0.12280399999872316,
"spec/mailers/user_mailer_spec.rb": 1.9315589999969234,
"spec/features/idv/doc_auth/verify_step_spec.rb": 178.04718500000308,
"spec/features/idv/steps/in_person/verify_step_spec.rb": 21.102479999986826,
"spec/models/event_spec.rb": 0.033781999998609535,
"spec/forms/security_event_form_spec.rb": 2.691689999999653,
"spec/forms/otp_delivery_selection_form_spec.rb": 0.10276400000293506,
Expand Down
105 changes: 38 additions & 67 deletions spec/features/idv/analytics_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
let(:fake_analytics) { FakeAnalytics.new }
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.

IIRC this spec was here to maintain continuity between analytics events with FSMv2 being put together. Is there any value here with FSMv2 gone or could we remove this entire spec file?

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.

Personally, I still see value in asserting the events that we're expecting to have been logged during identity verification. I also like how this is implemented as a single canonical list, though I wouldn't mind if they were part of feature specs for the individual steps if we could trust that we did so exhaustively (I don't trust this, FWIW).

I had actually planned to expand this spec to include events logged during IAL1 authentication, as a regression spec for an issue I recently identified.

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.

+1 this spec is also useful if we wanted to refactor/change out FSM but keep the analytics events we have for consistency

# rubocop:disable Layout/LineLength
let(:happy_path_events) do
common_events = {
{
'IdV: intro visited' => {},
'IdV: doc auth welcome visited' => { flow_path: 'standard', step: 'welcome', step_count: 1 },
'IdV: doc auth welcome submitted' => { success: true, errors: {}, flow_path: 'standard', step: 'welcome', step_count: 1 },
Expand Down Expand Up @@ -37,19 +37,11 @@
'IdV: final resolution' => { success: true },
'IdV: personal key visited' => {},
'IdV: personal key submitted' => {},
}
{
FSMv1: common_events.merge(
'Frontend: IdV: show personal key modal' => {},
),
FSMv2: common_events.merge(
'IdV: personal key confirm visited' => {},
'IdV: personal key confirm submitted' => {},
),
'Frontend: IdV: show personal key modal' => {},
}
end
let(:gpo_path_events) do
common_events = {
{
'IdV: intro visited' => {},
'IdV: doc auth welcome visited' => { flow_path: 'standard', step: 'welcome', step_count: 1 },
'IdV: doc auth welcome submitted' => { success: true, errors: {}, flow_path: 'standard', step: 'welcome', step_count: 1 },
Expand All @@ -75,10 +67,6 @@
'IdV: phone of record visited' => {},
'IdV: USPS address letter requested' => { enqueued_at: Time.zone.now },
}
{
FSMv1: common_events,
FSMv2: common_events,
}
end
let(:in_person_path_events) do
{
Expand Down Expand Up @@ -141,62 +129,45 @@
and_return(fake_analytics)
end

{
FSMv1: [],
FSMv2: %w[password_confirm personal_key personal_key_confirm],
}.each do |flow_version, steps_enabled|
context flow_version do
before do
allow(IdentityConfig.store).to receive(:idv_api_enabled_steps).and_return(steps_enabled)
WebMock.allow_net_connect!(net_http_connect_on_start: true)
end

after do
webmock_allow_list = WebMock::Config.instance.allow
WebMock.disallow_net_connect!(net_http_connect_on_start: nil, allow: webmock_allow_list)
end

context 'Happy path' do
before do
sign_in_and_2fa_user(user)
visit_idp_from_sp_with_ial2(:oidc)
complete_welcome_step
complete_agreement_step
complete_upload_step
complete_document_capture_step
complete_ssn_step
complete_verify_step
complete_phone_step(user)
complete_review_step(user)
acknowledge_and_confirm_personal_key
end
context 'Happy path' do
before do
sign_in_and_2fa_user(user)
visit_idp_from_sp_with_ial2(:oidc)
complete_welcome_step
complete_agreement_step
complete_upload_step
complete_document_capture_step
complete_ssn_step
complete_verify_step
complete_phone_step(user)
complete_review_step(user)
acknowledge_and_confirm_personal_key
end

it 'records all of the events' do
happy_path_events[flow_version].each do |event, _attributes|
expect(fake_analytics).to have_logged_event(event)
end
end
it 'records all of the events' do
happy_path_events.each do |event, _attributes|
expect(fake_analytics).to have_logged_event(event)
end
end
end

context 'GPO path' do
before do
sign_in_and_2fa_user(user)
visit_idp_from_sp_with_ial2(:oidc)
complete_welcome_step
complete_agreement_step
complete_upload_step
complete_document_capture_step
complete_ssn_step
complete_verify_step
enter_gpo_flow
gpo_step
end
context 'GPO path' do
before do
sign_in_and_2fa_user(user)
visit_idp_from_sp_with_ial2(:oidc)
complete_welcome_step
complete_agreement_step
complete_upload_step
complete_document_capture_step
complete_ssn_step
complete_verify_step
enter_gpo_flow
gpo_step
end

it 'records all of the events' do
gpo_path_events[flow_version].each do |event, _attributes|
expect(fake_analytics).to have_logged_event(event)
end
end
it 'records all of the events' do
gpo_path_events.each do |event, _attributes|
expect(fake_analytics).to have_logged_event(event)
end
end
end
Expand Down
32 changes: 0 additions & 32 deletions spec/features/idv/steps/confirmation_step_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,11 @@
feature 'idv confirmation step', js: true do
include IdvStepHelper

let(:idv_api_enabled_steps) { [] }
let(:idv_personal_key_confirmation_enabled) { true }
let(:sp) { nil }
let(:address_verification_mechanism) { :phone }

before do
allow(IdentityConfig.store).to receive(:idv_api_enabled_steps).and_return(idv_api_enabled_steps)
allow(IdentityConfig.store).to receive(:idv_personal_key_confirmation_enabled).
and_return(idv_personal_key_confirmation_enabled)
start_idv_from_sp(sp)
Expand All @@ -34,36 +32,6 @@
expect(page).to have_content(t('headings.personal_key'))
end

context 'with idv app feature enabled' do
let(:idv_api_enabled_steps) { ['password_confirm', 'personal_key', 'personal_key_confirm'] }

it_behaves_like 'personal key page'

it 'allows the user to refresh and still displays the personal key' do
# Visit the current path is the same as refreshing
visit current_path
expect(page).to have_content(t('headings.personal_key'))

acknowledge_and_confirm_personal_key
expect(page).to have_current_path(account_path)
end

context 'with personal key confirmation disabled' do
let(:idv_personal_key_confirmation_enabled) { false }

before do
click_continue if javascript_enabled?
end

it 'does not display modal content. and continues to the account page' do
expect(page).not_to have_content t('forms.personal_key.title')
expect(page).not_to have_content t('forms.personal_key.instructions')
expect(current_path).to eq(account_path)
expect(page).to have_content t('headings.account.verified_account')
end
end
end

context 'verifying by gpo' do
let(:address_verification_mechanism) { :gpo }

Expand Down
41 changes: 0 additions & 41 deletions spec/features/idv/steps/forgot_password_step_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -36,45 +36,4 @@

expect(current_path).to eq edit_user_password_path
end

context 'with idv app feature enabled' do
before do
allow(IdentityConfig.store).to receive(:idv_api_enabled_steps).
and_return(['password_confirm', 'personal_key', 'personal_key_confirm'])
end

it 'goes to the forgot password page from the review page' do
start_idv_from_sp
complete_idv_steps_before_review_step

click_link t('idv.forgot_password.link_text')

expect(page.current_path).to eq(idv_app_forgot_password_path)
end

it 'goes back to the review page from the forgot password page' do
start_idv_from_sp
complete_idv_steps_before_review_step

click_link t('idv.forgot_password.link_text')
click_link t('idv.forgot_password.try_again')

expect(page.current_path).to eq idv_app_path(step: :password_confirm)
end

it 'allows the user to reset their password' do
start_idv_from_sp
complete_idv_steps_before_review_step

click_link t('idv.forgot_password.link_text')
click_button t('idv.forgot_password.reset_password')

expect(page).to have_current_path(forgot_password_path, ignore_query: true, wait: 10)

open_last_email
click_email_link_matching(/reset_password_token/)

expect(current_path).to eq edit_user_password_path
end
end
end
5 changes: 0 additions & 5 deletions spec/features/idv/steps/in_person/verify_step_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -7,11 +7,6 @@

before do
allow(IdentityConfig.store).to receive(:in_person_proofing_enabled).and_return(true)
allow(IdentityConfig.store).to receive(:idv_api_enabled_steps).and_return(
['password_confirm',
'personal_key',
'personal_key_confirm'],
)
end

it 'provides back buttons for address, state ID, and SSN that discard changes',
Expand Down
34 changes: 0 additions & 34 deletions spec/features/idv/steps/review_step_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -111,38 +111,4 @@
end
end
end

context 'with idv app feature enabled', js: true do
before do
allow(IdentityConfig.store).to receive(:idv_api_enabled_steps).
and_return(['password_confirm', 'personal_key', 'personal_key_confirm'])
end

it 'redirects to personal key step after user enters their password', allow_browser_log: true do
start_idv_from_sp
complete_idv_steps_before_review_step

click_on t('idv.messages.review.intro')

expect(page).to have_content('FAKEY')
expect(page).to have_content('MCFAKERSON')
expect(page).to have_content('1 FAKE RD')
expect(page).to have_content('GREAT FALLS, MT 59010')
expect(page).to have_content('October 6, 1938')
expect(page).to have_content(DocAuthHelper::GOOD_SSN)
expect(page).to have_content('(202) 555-1212')

fill_in t('components.password_toggle.label'), with: 'this is not the right password'
click_idv_continue

expect(page).to have_content(t('idv.errors.incorrect_password'))
expect(page).to have_current_path(idv_app_path(step: :password_confirm))

fill_in t('components.password_toggle.label'), with: user_password
click_idv_continue

expect(page).to have_content(t('headings.personal_key'))
expect(page).to have_current_path(idv_app_path(step: :personal_key))
end
end
end