From 4f19d8ad123e3cd6d7718e9c5030c860df16d0d3 Mon Sep 17 00:00:00 2001 From: Sonia Connolly Date: Thu, 20 Jul 2023 09:01:13 -0700 Subject: [PATCH 01/20] GettingStarted A/B test uses user uuid, not session id --- .../idv/getting_started_ab_test_concern.rb | 2 +- .../getting_started_ab_test_concern_spec.rb | 29 +++++++------------ 2 files changed, 12 insertions(+), 19 deletions(-) diff --git a/app/controllers/concerns/idv/getting_started_ab_test_concern.rb b/app/controllers/concerns/idv/getting_started_ab_test_concern.rb index 212404a699c..bb04e946e27 100644 --- a/app/controllers/concerns/idv/getting_started_ab_test_concern.rb +++ b/app/controllers/concerns/idv/getting_started_ab_test_concern.rb @@ -1,7 +1,7 @@ module Idv module GettingStartedAbTestConcern def getting_started_a_b_test_bucket - AbTests::IDV_GETTING_STARTED.bucket(sp_session[:request_id] || session.id) + AbTests::IDV_GETTING_STARTED.bucket(current_user&.uuid) end def maybe_redirect_for_getting_started_ab_test diff --git a/spec/controllers/concerns/idv/getting_started_ab_test_concern_spec.rb b/spec/controllers/concerns/idv/getting_started_ab_test_concern_spec.rb index 464e40ddf96..7ed634841c6 100644 --- a/spec/controllers/concerns/idv/getting_started_ab_test_concern_spec.rb +++ b/spec/controllers/concerns/idv/getting_started_ab_test_concern_spec.rb @@ -2,9 +2,6 @@ RSpec.describe 'GettingStartedAbTestConcern' do let(:user) { create(:user, :fully_registered, email: 'old_email@example.com') } - let(:idv_session) do - Idv::Session.new(user_session: subject.user_session, current_user: user, service_provider: nil) - end module Idv class StepController < ApplicationController @@ -17,33 +14,31 @@ def show end describe '#getting_started_a_b_test_bucket' do - let(:sp_session) { {} } - controller Idv::StepController do end before do - allow(session).to receive(:id).and_return('session-id') - allow(controller).to receive(:sp_session).and_return(sp_session) + allow(controller).to receive(:current_user).and_return(user) allow(AbTests::IDV_GETTING_STARTED).to receive(:bucket) do |discriminator| case discriminator - when 'session-id' - :welcome - when 'request-id' + when user.uuid :getting_started + else :welcome end end end - it 'returns the bucket based on session id' do - expect(controller.getting_started_a_b_test_bucket).to eq(:welcome) + it 'returns the bucket based on user id' do + expect(controller.getting_started_a_b_test_bucket).to eq(:getting_started) end - context 'with associated sp session request id' do - let(:sp_session) { { request_id: 'request-id' } } - + context 'with a different user' do + before do + user2 = create(:user, :fully_registered, email: 'new_email@example.com') + allow(controller).to receive(:current_user).and_return(user2) + end it 'returns the bucket based on request id' do - expect(controller.getting_started_a_b_test_bucket).to eq(:getting_started) + expect(controller.getting_started_a_b_test_bucket).to eq(:welcome) end end end @@ -60,8 +55,6 @@ def show end end - let(:session_uuid) { SecureRandom.uuid } - context 'A/B test specifies getting started page' do before do allow(controller).to receive(:getting_started_a_b_test_bucket). From 8dff6cac70d2b852a0cce38dfc02e367ced8344b Mon Sep 17 00:00:00 2001 From: Sonia Connolly Date: Thu, 20 Jul 2023 09:03:45 -0700 Subject: [PATCH 02/20] Prepare to remove StepUtilitiesConcern Include in IdvSession concern and remove inclusion everywhere else --- app/controllers/concerns/idv_session.rb | 2 ++ app/controllers/idv/agreement_controller.rb | 1 - app/controllers/idv/document_capture_controller.rb | 2 -- app/controllers/idv/getting_started_controller.rb | 1 - app/controllers/idv/hybrid_handoff_controller.rb | 1 - app/controllers/idv/in_person/ssn_controller.rb | 1 - app/controllers/idv/in_person/verify_info_controller.rb | 3 +-- app/controllers/idv/link_sent_controller.rb | 1 - app/controllers/idv/ssn_controller.rb | 1 - app/controllers/idv/verify_info_controller.rb | 1 - app/controllers/idv/welcome_controller.rb | 1 - 11 files changed, 3 insertions(+), 12 deletions(-) diff --git a/app/controllers/concerns/idv_session.rb b/app/controllers/concerns/idv_session.rb index 3dd264acdc6..17d01899840 100644 --- a/app/controllers/concerns/idv_session.rb +++ b/app/controllers/concerns/idv_session.rb @@ -1,6 +1,8 @@ module IdvSession extend ActiveSupport::Concern + include Idv::StepUtilitiesConcern + included do before_action :redirect_unless_idv_session_user before_action :redirect_if_sp_context_needed diff --git a/app/controllers/idv/agreement_controller.rb b/app/controllers/idv/agreement_controller.rb index dda0c8b750f..afbd91ca684 100644 --- a/app/controllers/idv/agreement_controller.rb +++ b/app/controllers/idv/agreement_controller.rb @@ -2,7 +2,6 @@ module Idv class AgreementController < ApplicationController include IdvStepConcern include StepIndicatorConcern - include StepUtilitiesConcern before_action :confirm_welcome_step_complete before_action :confirm_agreement_needed diff --git a/app/controllers/idv/document_capture_controller.rb b/app/controllers/idv/document_capture_controller.rb index ba4a87a6ffd..a9b31974bff 100644 --- a/app/controllers/idv/document_capture_controller.rb +++ b/app/controllers/idv/document_capture_controller.rb @@ -4,8 +4,6 @@ class DocumentCaptureController < ApplicationController include DocumentCaptureConcern include IdvStepConcern include StepIndicatorConcern - include StepUtilitiesConcern - include RateLimitConcern before_action :confirm_hybrid_handoff_complete before_action :confirm_document_capture_needed diff --git a/app/controllers/idv/getting_started_controller.rb b/app/controllers/idv/getting_started_controller.rb index e0a38117053..8f27a4ddde2 100644 --- a/app/controllers/idv/getting_started_controller.rb +++ b/app/controllers/idv/getting_started_controller.rb @@ -1,7 +1,6 @@ module Idv class GettingStartedController < ApplicationController include IdvStepConcern - include StepUtilitiesConcern before_action :confirm_agreement_needed diff --git a/app/controllers/idv/hybrid_handoff_controller.rb b/app/controllers/idv/hybrid_handoff_controller.rb index c01e882cf95..4731d847b3e 100644 --- a/app/controllers/idv/hybrid_handoff_controller.rb +++ b/app/controllers/idv/hybrid_handoff_controller.rb @@ -3,7 +3,6 @@ class HybridHandoffController < ApplicationController include ActionView::Helpers::DateHelper include IdvStepConcern include StepIndicatorConcern - include StepUtilitiesConcern before_action :confirm_agreement_step_complete before_action :confirm_hybrid_handoff_needed, only: :show diff --git a/app/controllers/idv/in_person/ssn_controller.rb b/app/controllers/idv/in_person/ssn_controller.rb index 7b19a8d75e5..ec27ce693fd 100644 --- a/app/controllers/idv/in_person/ssn_controller.rb +++ b/app/controllers/idv/in_person/ssn_controller.rb @@ -3,7 +3,6 @@ module InPerson class SsnController < ApplicationController include IdvStepConcern include StepIndicatorConcern - include StepUtilitiesConcern include Steps::ThreatMetrixStepHelper include ThreatMetrixConcern diff --git a/app/controllers/idv/in_person/verify_info_controller.rb b/app/controllers/idv/in_person/verify_info_controller.rb index 724bf424a50..9430865778a 100644 --- a/app/controllers/idv/in_person/verify_info_controller.rb +++ b/app/controllers/idv/in_person/verify_info_controller.rb @@ -3,7 +3,6 @@ module InPerson class VerifyInfoController < ApplicationController include IdvStepConcern include StepIndicatorConcern - include StepUtilitiesConcern include Steps::ThreatMetrixStepHelper include VerifyInfoConcern @@ -63,7 +62,7 @@ def pii @pii = flow_session[:pii_from_user] end - # override StepUtilitiesConcern + # override IdvSession concern def flow_session user_session.fetch('idv/in_person', {}) end diff --git a/app/controllers/idv/link_sent_controller.rb b/app/controllers/idv/link_sent_controller.rb index bc2c9acf34a..41ef73a19f7 100644 --- a/app/controllers/idv/link_sent_controller.rb +++ b/app/controllers/idv/link_sent_controller.rb @@ -3,7 +3,6 @@ class LinkSentController < ApplicationController include DocumentCaptureConcern include IdvStepConcern include StepIndicatorConcern - include StepUtilitiesConcern before_action :confirm_hybrid_handoff_complete before_action :confirm_document_capture_needed diff --git a/app/controllers/idv/ssn_controller.rb b/app/controllers/idv/ssn_controller.rb index ec04107b627..b919eddaafb 100644 --- a/app/controllers/idv/ssn_controller.rb +++ b/app/controllers/idv/ssn_controller.rb @@ -2,7 +2,6 @@ module Idv class SsnController < ApplicationController include IdvStepConcern include StepIndicatorConcern - include StepUtilitiesConcern include Steps::ThreatMetrixStepHelper include ThreatMetrixConcern diff --git a/app/controllers/idv/verify_info_controller.rb b/app/controllers/idv/verify_info_controller.rb index 02c0bf9b16a..08a91182849 100644 --- a/app/controllers/idv/verify_info_controller.rb +++ b/app/controllers/idv/verify_info_controller.rb @@ -1,7 +1,6 @@ module Idv class VerifyInfoController < ApplicationController include IdvStepConcern - include StepUtilitiesConcern include StepIndicatorConcern include VerifyInfoConcern include Steps::ThreatMetrixStepHelper diff --git a/app/controllers/idv/welcome_controller.rb b/app/controllers/idv/welcome_controller.rb index f352e6ca4ec..ba167adaa09 100644 --- a/app/controllers/idv/welcome_controller.rb +++ b/app/controllers/idv/welcome_controller.rb @@ -2,7 +2,6 @@ module Idv class WelcomeController < ApplicationController include IdvStepConcern include StepIndicatorConcern - include StepUtilitiesConcern include GettingStartedAbTestConcern before_action :confirm_welcome_needed From 511914b4d60d2d224bc6d04b6becee5d41a3a7d5 Mon Sep 17 00:00:00 2001 From: Sonia Connolly Date: Thu, 20 Jul 2023 09:08:15 -0700 Subject: [PATCH 03/20] Move StepUtilitiesConcern methods into IdvSession concern Because two of the methods reference document_capture_session which is related to flow_session and may move into idv_session And irs_reproofing? will probably be deleted soon --- .../concerns/idv/step_utilities_concern.rb | 23 ------------------- app/controllers/concerns/idv_session.rb | 19 +++++++++++++-- 2 files changed, 17 insertions(+), 25 deletions(-) delete mode 100644 app/controllers/concerns/idv/step_utilities_concern.rb diff --git a/app/controllers/concerns/idv/step_utilities_concern.rb b/app/controllers/concerns/idv/step_utilities_concern.rb deleted file mode 100644 index 51e4ac581e0..00000000000 --- a/app/controllers/concerns/idv/step_utilities_concern.rb +++ /dev/null @@ -1,23 +0,0 @@ -module Idv - module StepUtilitiesConcern - extend ActiveSupport::Concern - include AcuantConcern - - def irs_reproofing? - current_user&.reproof_for_irs?( - service_provider: current_sp, - ).present? - end - - def document_capture_session_uuid - flow_session[:document_capture_session_uuid] - end - - def document_capture_session - return @document_capture_session if defined?(@document_capture_session) - @document_capture_session = DocumentCaptureSession.find_by( - uuid: document_capture_session_uuid, - ) - end - end -end diff --git a/app/controllers/concerns/idv_session.rb b/app/controllers/concerns/idv_session.rb index 17d01899840..1cc02a797e5 100644 --- a/app/controllers/concerns/idv_session.rb +++ b/app/controllers/concerns/idv_session.rb @@ -1,8 +1,6 @@ module IdvSession extend ActiveSupport::Concern - include Idv::StepUtilitiesConcern - included do before_action :redirect_unless_idv_session_user before_action :redirect_if_sp_context_needed @@ -39,6 +37,23 @@ def flow_session user_session['idv/doc_auth'] ||= {} end + def irs_reproofing? + current_user&.reproof_for_irs?( + service_provider: current_sp, + ).present? + end + + def document_capture_session_uuid + flow_session[:document_capture_session_uuid] + end + + def document_capture_session + return @document_capture_session if defined?(@document_capture_session) + @document_capture_session = DocumentCaptureSession.find_by( + uuid: document_capture_session_uuid, + ) + end + def redirect_unless_idv_session_user redirect_to root_url if !idv_session_user end From b7c5423fcd442da420900951318130f37869d804 Mon Sep 17 00:00:00 2001 From: Sonia Connolly Date: Thu, 20 Jul 2023 09:25:40 -0700 Subject: [PATCH 04/20] Replace acuant_sdk_ab_test_analytics_args with ab_test_analytics_args Currently defined identically in Idv::AbTestAnalyticsConcern --- .../concerns/idv/ab_test_analytics_concern.rb | 9 +++++++++ .../concerns/idv/getting_started_ab_test_concern.rb | 9 +++++++++ .../concerns/idv/hybrid_mobile/hybrid_mobile_concern.rb | 1 + app/controllers/concerns/idv_step_concern.rb | 1 + app/controllers/idv/document_capture_controller.rb | 2 +- app/controllers/idv/hybrid_handoff_controller.rb | 2 +- .../idv/hybrid_mobile/capture_complete_controller.rb | 2 +- .../idv/hybrid_mobile/document_capture_controller.rb | 2 +- app/controllers/idv/in_person/ssn_controller.rb | 2 +- app/controllers/idv/in_person/verify_info_controller.rb | 2 +- app/controllers/idv/link_sent_controller.rb | 2 +- app/controllers/idv/ssn_controller.rb | 2 +- app/controllers/idv/verify_info_controller.rb | 2 +- 13 files changed, 29 insertions(+), 9 deletions(-) create mode 100644 app/controllers/concerns/idv/ab_test_analytics_concern.rb diff --git a/app/controllers/concerns/idv/ab_test_analytics_concern.rb b/app/controllers/concerns/idv/ab_test_analytics_concern.rb new file mode 100644 index 00000000000..ad3636b3f2d --- /dev/null +++ b/app/controllers/concerns/idv/ab_test_analytics_concern.rb @@ -0,0 +1,9 @@ +module Idv + module AbTestAnalyticsConcern + include AcuantConcern + + def ab_test_analytics_args + acuant_sdk_ab_test_analytics_args + end + end +end diff --git a/app/controllers/concerns/idv/getting_started_ab_test_concern.rb b/app/controllers/concerns/idv/getting_started_ab_test_concern.rb index bb04e946e27..c28d2821d2c 100644 --- a/app/controllers/concerns/idv/getting_started_ab_test_concern.rb +++ b/app/controllers/concerns/idv/getting_started_ab_test_concern.rb @@ -9,5 +9,14 @@ def maybe_redirect_for_getting_started_ab_test redirect_to idv_getting_started_url end + + def getting_started_ab_test_analytics_args + return {} if current_user.blank? + + { + getting_started_ab_test_bucket: + getting_started_a_b_test_bucket, + } + end end end diff --git a/app/controllers/concerns/idv/hybrid_mobile/hybrid_mobile_concern.rb b/app/controllers/concerns/idv/hybrid_mobile/hybrid_mobile_concern.rb index 634f89ee9cf..6d5054110e1 100644 --- a/app/controllers/concerns/idv/hybrid_mobile/hybrid_mobile_concern.rb +++ b/app/controllers/concerns/idv/hybrid_mobile/hybrid_mobile_concern.rb @@ -4,6 +4,7 @@ module HybridMobileConcern extend ActiveSupport::Concern include AcuantConcern + include Idv::AbTestAnalyticsConcern def check_valid_document_capture_session if !document_capture_user diff --git a/app/controllers/concerns/idv_step_concern.rb b/app/controllers/concerns/idv_step_concern.rb index d79fda7382e..d9fa8721075 100644 --- a/app/controllers/concerns/idv_step_concern.rb +++ b/app/controllers/concerns/idv_step_concern.rb @@ -5,6 +5,7 @@ module IdvStepConcern include RateLimitConcern include FraudReviewConcern include Idv::OutageConcern + include Idv::AbTestAnalyticsConcern included do before_action :confirm_two_factor_authenticated diff --git a/app/controllers/idv/document_capture_controller.rb b/app/controllers/idv/document_capture_controller.rb index a9b31974bff..8645f7076d0 100644 --- a/app/controllers/idv/document_capture_controller.rb +++ b/app/controllers/idv/document_capture_controller.rb @@ -75,7 +75,7 @@ def analytics_arguments analytics_id: 'Doc Auth', irs_reproofing: irs_reproofing?, redo_document_capture: flow_session[:redo_document_capture], - }.compact.merge(**acuant_sdk_ab_test_analytics_args) + }.compact.merge(**ab_test_analytics_args) end def handle_stored_result diff --git a/app/controllers/idv/hybrid_handoff_controller.rb b/app/controllers/idv/hybrid_handoff_controller.rb index 4731d847b3e..0fc7b9cebf0 100644 --- a/app/controllers/idv/hybrid_handoff_controller.rb +++ b/app/controllers/idv/hybrid_handoff_controller.rb @@ -156,7 +156,7 @@ def analytics_arguments analytics_id: 'Doc Auth', irs_reproofing: irs_reproofing?, redo_document_capture: params[:redo] ? true : nil, - }.compact.merge(**acuant_sdk_ab_test_analytics_args) + }.compact.merge(**ab_test_analytics_args) end def form_response(destination:) diff --git a/app/controllers/idv/hybrid_mobile/capture_complete_controller.rb b/app/controllers/idv/hybrid_mobile/capture_complete_controller.rb index 005033c42be..274dcf86b7f 100644 --- a/app/controllers/idv/hybrid_mobile/capture_complete_controller.rb +++ b/app/controllers/idv/hybrid_mobile/capture_complete_controller.rb @@ -22,7 +22,7 @@ def analytics_arguments step: 'capture_complete', analytics_id: 'Doc Auth', irs_reproofing: irs_reproofing?, - }.merge(**acuant_sdk_ab_test_analytics_args) + }.merge(**ab_test_analytics_args) end end end diff --git a/app/controllers/idv/hybrid_mobile/document_capture_controller.rb b/app/controllers/idv/hybrid_mobile/document_capture_controller.rb index 41c3fd4781d..566a63f0124 100644 --- a/app/controllers/idv/hybrid_mobile/document_capture_controller.rb +++ b/app/controllers/idv/hybrid_mobile/document_capture_controller.rb @@ -57,7 +57,7 @@ def analytics_arguments step: 'document_capture', analytics_id: 'Doc Auth', irs_reproofing: irs_reproofing?, - }.merge(**acuant_sdk_ab_test_analytics_args) + }.merge(**ab_test_analytics_args) end def handle_stored_result diff --git a/app/controllers/idv/in_person/ssn_controller.rb b/app/controllers/idv/in_person/ssn_controller.rb index ec27ce693fd..59df141f1a4 100644 --- a/app/controllers/idv/in_person/ssn_controller.rb +++ b/app/controllers/idv/in_person/ssn_controller.rb @@ -83,7 +83,7 @@ def analytics_arguments step: 'ssn', analytics_id: 'In Person Proofing', irs_reproofing: irs_reproofing?, - }.merge(**acuant_sdk_ab_test_analytics_args) + }.merge(**ab_test_analytics_args) end def updating_ssn? diff --git a/app/controllers/idv/in_person/verify_info_controller.rb b/app/controllers/idv/in_person/verify_info_controller.rb index 9430865778a..ae62f5e2c95 100644 --- a/app/controllers/idv/in_person/verify_info_controller.rb +++ b/app/controllers/idv/in_person/verify_info_controller.rb @@ -73,7 +73,7 @@ def analytics_arguments step: 'verify', analytics_id: 'In Person Proofing', irs_reproofing: irs_reproofing?, - }.merge(**acuant_sdk_ab_test_analytics_args). + }.merge(**ab_test_analytics_args). merge(**extra_analytics_properties) end diff --git a/app/controllers/idv/link_sent_controller.rb b/app/controllers/idv/link_sent_controller.rb index 41ef73a19f7..ec053cb849a 100644 --- a/app/controllers/idv/link_sent_controller.rb +++ b/app/controllers/idv/link_sent_controller.rb @@ -62,7 +62,7 @@ def analytics_arguments analytics_id: 'Doc Auth', flow_path: 'hybrid', irs_reproofing: irs_reproofing?, - }.merge(**acuant_sdk_ab_test_analytics_args) + }.merge(**ab_test_analytics_args) end def handle_document_verification_success(get_results_response) diff --git a/app/controllers/idv/ssn_controller.rb b/app/controllers/idv/ssn_controller.rb index b919eddaafb..a7d93b9f2c1 100644 --- a/app/controllers/idv/ssn_controller.rb +++ b/app/controllers/idv/ssn_controller.rb @@ -89,7 +89,7 @@ def analytics_arguments step: 'ssn', analytics_id: 'Doc Auth', irs_reproofing: irs_reproofing?, - }.merge(**acuant_sdk_ab_test_analytics_args) + }.merge(**ab_test_analytics_args) end def updating_ssn? diff --git a/app/controllers/idv/verify_info_controller.rb b/app/controllers/idv/verify_info_controller.rb index 08a91182849..13f0d678f03 100644 --- a/app/controllers/idv/verify_info_controller.rb +++ b/app/controllers/idv/verify_info_controller.rb @@ -51,7 +51,7 @@ def analytics_arguments step: 'verify', analytics_id: 'Doc Auth', irs_reproofing: irs_reproofing?, - }.merge(**acuant_sdk_ab_test_analytics_args) + }.merge(**ab_test_analytics_args) end # copied from verify_step From 6b91063fb67b729f5bd301a5fa26676d0f277478 Mon Sep 17 00:00:00 2001 From: Sonia Connolly Date: Thu, 20 Jul 2023 09:37:57 -0700 Subject: [PATCH 05/20] Remove unneeded ** before merge of ab_test_analytics_args --- app/controllers/idv/document_capture_controller.rb | 2 +- app/controllers/idv/hybrid_handoff_controller.rb | 2 +- .../idv/hybrid_mobile/capture_complete_controller.rb | 2 +- .../idv/hybrid_mobile/document_capture_controller.rb | 2 +- app/controllers/idv/in_person/ssn_controller.rb | 2 +- app/controllers/idv/in_person/verify_info_controller.rb | 2 +- app/controllers/idv/link_sent_controller.rb | 2 +- app/controllers/idv/ssn_controller.rb | 2 +- app/controllers/idv/verify_info_controller.rb | 2 +- 9 files changed, 9 insertions(+), 9 deletions(-) diff --git a/app/controllers/idv/document_capture_controller.rb b/app/controllers/idv/document_capture_controller.rb index 8645f7076d0..94519526b4d 100644 --- a/app/controllers/idv/document_capture_controller.rb +++ b/app/controllers/idv/document_capture_controller.rb @@ -75,7 +75,7 @@ def analytics_arguments analytics_id: 'Doc Auth', irs_reproofing: irs_reproofing?, redo_document_capture: flow_session[:redo_document_capture], - }.compact.merge(**ab_test_analytics_args) + }.compact.merge(ab_test_analytics_args) end def handle_stored_result diff --git a/app/controllers/idv/hybrid_handoff_controller.rb b/app/controllers/idv/hybrid_handoff_controller.rb index 0fc7b9cebf0..c61460bf48b 100644 --- a/app/controllers/idv/hybrid_handoff_controller.rb +++ b/app/controllers/idv/hybrid_handoff_controller.rb @@ -156,7 +156,7 @@ def analytics_arguments analytics_id: 'Doc Auth', irs_reproofing: irs_reproofing?, redo_document_capture: params[:redo] ? true : nil, - }.compact.merge(**ab_test_analytics_args) + }.compact.merge(ab_test_analytics_args) end def form_response(destination:) diff --git a/app/controllers/idv/hybrid_mobile/capture_complete_controller.rb b/app/controllers/idv/hybrid_mobile/capture_complete_controller.rb index 274dcf86b7f..34fa1d6d05a 100644 --- a/app/controllers/idv/hybrid_mobile/capture_complete_controller.rb +++ b/app/controllers/idv/hybrid_mobile/capture_complete_controller.rb @@ -22,7 +22,7 @@ def analytics_arguments step: 'capture_complete', analytics_id: 'Doc Auth', irs_reproofing: irs_reproofing?, - }.merge(**ab_test_analytics_args) + }.merge(ab_test_analytics_args) end end end diff --git a/app/controllers/idv/hybrid_mobile/document_capture_controller.rb b/app/controllers/idv/hybrid_mobile/document_capture_controller.rb index 566a63f0124..6ce82f20be3 100644 --- a/app/controllers/idv/hybrid_mobile/document_capture_controller.rb +++ b/app/controllers/idv/hybrid_mobile/document_capture_controller.rb @@ -57,7 +57,7 @@ def analytics_arguments step: 'document_capture', analytics_id: 'Doc Auth', irs_reproofing: irs_reproofing?, - }.merge(**ab_test_analytics_args) + }.merge(ab_test_analytics_args) end def handle_stored_result diff --git a/app/controllers/idv/in_person/ssn_controller.rb b/app/controllers/idv/in_person/ssn_controller.rb index 59df141f1a4..f3907e8be1c 100644 --- a/app/controllers/idv/in_person/ssn_controller.rb +++ b/app/controllers/idv/in_person/ssn_controller.rb @@ -83,7 +83,7 @@ def analytics_arguments step: 'ssn', analytics_id: 'In Person Proofing', irs_reproofing: irs_reproofing?, - }.merge(**ab_test_analytics_args) + }.merge(ab_test_analytics_args) end def updating_ssn? diff --git a/app/controllers/idv/in_person/verify_info_controller.rb b/app/controllers/idv/in_person/verify_info_controller.rb index ae62f5e2c95..b6b0f21139b 100644 --- a/app/controllers/idv/in_person/verify_info_controller.rb +++ b/app/controllers/idv/in_person/verify_info_controller.rb @@ -73,7 +73,7 @@ def analytics_arguments step: 'verify', analytics_id: 'In Person Proofing', irs_reproofing: irs_reproofing?, - }.merge(**ab_test_analytics_args). + }.merge(ab_test_analytics_args). merge(**extra_analytics_properties) end diff --git a/app/controllers/idv/link_sent_controller.rb b/app/controllers/idv/link_sent_controller.rb index ec053cb849a..e4d4395afb8 100644 --- a/app/controllers/idv/link_sent_controller.rb +++ b/app/controllers/idv/link_sent_controller.rb @@ -62,7 +62,7 @@ def analytics_arguments analytics_id: 'Doc Auth', flow_path: 'hybrid', irs_reproofing: irs_reproofing?, - }.merge(**ab_test_analytics_args) + }.merge(ab_test_analytics_args) end def handle_document_verification_success(get_results_response) diff --git a/app/controllers/idv/ssn_controller.rb b/app/controllers/idv/ssn_controller.rb index a7d93b9f2c1..fd4d4864da3 100644 --- a/app/controllers/idv/ssn_controller.rb +++ b/app/controllers/idv/ssn_controller.rb @@ -89,7 +89,7 @@ def analytics_arguments step: 'ssn', analytics_id: 'Doc Auth', irs_reproofing: irs_reproofing?, - }.merge(**ab_test_analytics_args) + }.merge(ab_test_analytics_args) end def updating_ssn? diff --git a/app/controllers/idv/verify_info_controller.rb b/app/controllers/idv/verify_info_controller.rb index 13f0d678f03..1ad9611573c 100644 --- a/app/controllers/idv/verify_info_controller.rb +++ b/app/controllers/idv/verify_info_controller.rb @@ -51,7 +51,7 @@ def analytics_arguments step: 'verify', analytics_id: 'Doc Auth', irs_reproofing: irs_reproofing?, - }.merge(**ab_test_analytics_args) + }.merge(ab_test_analytics_args) end # copied from verify_step From 6ada06f02ad5e479a61b347cafe8e7bc2c228bae Mon Sep 17 00:00:00 2001 From: Sonia Connolly Date: Thu, 20 Jul 2023 11:52:40 -0700 Subject: [PATCH 06/20] Remove unneeded native_camera_ab_testing_variables method from hybrid_mobile document capture controller Co-authored-by: Matt Hinz --- .../idv/hybrid_mobile/document_capture_controller.rb | 8 -------- 1 file changed, 8 deletions(-) diff --git a/app/controllers/idv/hybrid_mobile/document_capture_controller.rb b/app/controllers/idv/hybrid_mobile/document_capture_controller.rb index 6ce82f20be3..f69db4ea344 100644 --- a/app/controllers/idv/hybrid_mobile/document_capture_controller.rb +++ b/app/controllers/idv/hybrid_mobile/document_capture_controller.rb @@ -44,7 +44,6 @@ def extra_view_variables document_capture_session_uuid: document_capture_session_uuid, failure_to_proof_url: return_to_sp_failure_to_proof_url(step: 'document_capture'), }.merge( - native_camera_ab_testing_variables, acuant_sdk_upgrade_a_b_testing_variables, ) end @@ -70,13 +69,6 @@ def handle_stored_result failure(I18n.t('doc_auth.errors.general.network_error'), extra) end end - - def native_camera_ab_testing_variables - { - acuant_sdk_upgrade_ab_test_bucket: - AbTests::ACUANT_SDK.bucket(document_capture_session_uuid), - } - end end end end From fd2ff9fdde16bdc2f9232ef46f38833fe2c16503 Mon Sep 17 00:00:00 2001 From: Sonia Connolly Date: Thu, 20 Jul 2023 12:37:20 -0700 Subject: [PATCH 07/20] Add specs for AbTestAnalyticsConcern and then mock in controller specs This allows adding and removing A/B tests without editing all these specs Also add GettingStarted A/B test to ab_test_analytics_args --- .../concerns/idv/ab_test_analytics_concern.rb | 4 ++- .../idv/ab_test_analytics_concern_spec.rb | 28 +++++++++++++++++ .../idv/document_capture_controller_spec.rb | 12 ++++--- .../idv/hybrid_handoff_controller_spec.rb | 31 +++++++++++++------ .../capture_complete_controller_spec.rb | 8 +++-- .../document_capture_controller_spec.rb | 12 ++++--- .../idv/in_person/ssn_controller_spec.rb | 7 ++++- .../in_person/verify_info_controller_spec.rb | 7 ++++- .../idv/link_sent_controller_spec.rb | 13 +++++--- spec/controllers/idv/ssn_controller_spec.rb | 11 +++++-- .../idv/verify_info_controller_spec.rb | 9 ++++-- 11 files changed, 111 insertions(+), 31 deletions(-) create mode 100644 spec/controllers/concerns/idv/ab_test_analytics_concern_spec.rb diff --git a/app/controllers/concerns/idv/ab_test_analytics_concern.rb b/app/controllers/concerns/idv/ab_test_analytics_concern.rb index ad3636b3f2d..7391b45a02d 100644 --- a/app/controllers/concerns/idv/ab_test_analytics_concern.rb +++ b/app/controllers/concerns/idv/ab_test_analytics_concern.rb @@ -1,9 +1,11 @@ module Idv module AbTestAnalyticsConcern include AcuantConcern + include Idv::GettingStartedAbTestConcern def ab_test_analytics_args - acuant_sdk_ab_test_analytics_args + acuant_sdk_ab_test_analytics_args. + merge(getting_started_ab_test_analytics_args) end end end diff --git a/spec/controllers/concerns/idv/ab_test_analytics_concern_spec.rb b/spec/controllers/concerns/idv/ab_test_analytics_concern_spec.rb new file mode 100644 index 00000000000..c5fa801246e --- /dev/null +++ b/spec/controllers/concerns/idv/ab_test_analytics_concern_spec.rb @@ -0,0 +1,28 @@ +require 'rails_helper' + +RSpec.describe 'AbTestAnalyticsConcern' do + module Idv + class StepController < ApplicationController + include AbTestAnalyticsConcern + end + end + + describe '#ab_test_analytics_args' do + controller Idv::StepController do + end + + it 'includes acuant_sdk_ab_test_analytics_args' do + acuant_sdk_args = { as_bucket: :as_value } + expect(subject).to receive(:acuant_sdk_ab_test_analytics_args). + and_return(acuant_sdk_args) + expect(controller.ab_test_analytics_args).to include(acuant_sdk_args) + end + + it 'includes getting_started_ab_test_analytics_args' do + getting_started_args = { gs_bucket: :gs_value } + expect(subject).to receive(:acuant_sdk_ab_test_analytics_args). + and_return(getting_started_args) + expect(controller.ab_test_analytics_args).to include(getting_started_args) + end + end +end diff --git a/spec/controllers/idv/document_capture_controller_spec.rb b/spec/controllers/idv/document_capture_controller_spec.rb index fc8ddda6f7c..ca77dbf558a 100644 --- a/spec/controllers/idv/document_capture_controller_spec.rb +++ b/spec/controllers/idv/document_capture_controller_spec.rb @@ -10,11 +10,17 @@ let(:user) { create(:user) } + let(:ab_test_args) do + { sample_bucket1: :sample_value1, sample_bucket2: :sample_value2 } + end + before do stub_sign_in(user) stub_analytics subject.idv_session.flow_path = 'standard' subject.user_session['idv/doc_auth'] = flow_session + + allow(subject).to receive(:ab_test_analytics_args).and_return(ab_test_args) end describe 'before_actions' do @@ -48,8 +54,7 @@ flow_path: 'standard', irs_reproofing: false, step: 'document_capture', - acuant_sdk_upgrade_ab_test_bucket: :default, - } + }.merge(ab_test_args) end it 'renders the show template' do @@ -140,8 +145,7 @@ flow_path: 'standard', irs_reproofing: false, step: 'document_capture', - acuant_sdk_upgrade_ab_test_bucket: :default, - } + }.merge(ab_test_args) end let(:result) { { success: true, errors: {} } } diff --git a/spec/controllers/idv/hybrid_handoff_controller_spec.rb b/spec/controllers/idv/hybrid_handoff_controller_spec.rb index 351a059ecb6..b9500de5fb9 100644 --- a/spec/controllers/idv/hybrid_handoff_controller_spec.rb +++ b/spec/controllers/idv/hybrid_handoff_controller_spec.rb @@ -5,12 +5,17 @@ let(:user) { create(:user) } + let(:ab_test_args) do + { sample_bucket1: :sample_value1, sample_bucket2: :sample_value2 } + end + before do stub_sign_in(user) stub_analytics stub_attempts_tracker subject.user_session['idv/doc_auth'] = {} subject.idv_session.idv_consent_given = true + allow(subject).to receive(:ab_test_analytics_args).and_return(ab_test_args) end describe 'before_actions' do @@ -46,9 +51,11 @@ describe '#show' do let(:analytics_name) { 'IdV: doc auth hybrid handoff visited' } let(:analytics_args) do - { step: 'hybrid_handoff', + { + step: 'hybrid_handoff', analytics_id: 'Doc Auth', - irs_reproofing: false } + irs_reproofing: false, + }.merge(ab_test_args) end it 'renders the show template' do @@ -141,17 +148,21 @@ context 'hybrid flow' do let(:analytics_args) do - { success: true, + { + success: true, errors: { message: nil }, destination: :link_sent, flow_path: 'hybrid', step: 'hybrid_handoff', analytics_id: 'Doc Auth', irs_reproofing: false, - telephony_response: { errors: {}, - message_id: 'fake-message-id', - request_id: 'fake-message-request-id', - success: true } } + telephony_response: { + errors: {}, + message_id: 'fake-message-id', + request_id: 'fake-message-request-id', + success: true, + }, + }.merge(ab_test_args) end it 'sends analytics_submitted event for hybrid' do @@ -164,14 +175,16 @@ context 'desktop flow' do let(:analytics_args) do - { success: true, + { + success: true, errors: {}, destination: :document_capture, flow_path: 'standard', step: 'hybrid_handoff', analytics_id: 'Doc Auth', irs_reproofing: false, - skip_upload_step: false } + skip_upload_step: false, + }.merge(ab_test_args) end it 'sends analytics_submitted event for desktop' do diff --git a/spec/controllers/idv/hybrid_mobile/capture_complete_controller_spec.rb b/spec/controllers/idv/hybrid_mobile/capture_complete_controller_spec.rb index 74802292299..7a70fba615d 100644 --- a/spec/controllers/idv/hybrid_mobile/capture_complete_controller_spec.rb +++ b/spec/controllers/idv/hybrid_mobile/capture_complete_controller_spec.rb @@ -22,6 +22,10 @@ ) end + let(:ab_test_args) do + { sample_bucket1: :sample_value1, sample_bucket2: :sample_value2 } + end + before do session[:doc_capture_user_id] = user&.id session[:document_capture_session_uuid] = document_capture_session_uuid @@ -29,6 +33,7 @@ allow(@analytics).to receive(:track_event) allow(subject).to receive(:confirm_document_capture_session_complete). and_return(true) + allow(subject).to receive(:ab_test_analytics_args).and_return(ab_test_args) end describe 'before_actions' do @@ -44,12 +49,11 @@ let(:analytics_name) { 'IdV: doc auth capture_complete visited' } let(:analytics_args) do { - acuant_sdk_upgrade_ab_test_bucket: :default, analytics_id: 'Doc Auth', flow_path: 'hybrid', irs_reproofing: false, step: 'capture_complete', - } + }.merge(ab_test_args) end it 'renders the show template' do diff --git a/spec/controllers/idv/hybrid_mobile/document_capture_controller_spec.rb b/spec/controllers/idv/hybrid_mobile/document_capture_controller_spec.rb index 3c410025118..50daf410812 100644 --- a/spec/controllers/idv/hybrid_mobile/document_capture_controller_spec.rb +++ b/spec/controllers/idv/hybrid_mobile/document_capture_controller_spec.rb @@ -16,12 +16,18 @@ let(:document_capture_session_requested_at) { Time.zone.now } + let(:ab_test_args) do + { sample_bucket1: :sample_value1, sample_bucket2: :sample_value2 } + end + before do stub_analytics stub_attempts_tracker session[:doc_capture_user_id] = user&.id session[:document_capture_session_uuid] = document_capture_session_uuid + + allow(subject).to receive(:ab_test_analytics_args).and_return(ab_test_args) end describe 'before_actions' do @@ -48,12 +54,11 @@ let(:analytics_name) { 'IdV: doc auth document_capture visited' } let(:analytics_args) do { - acuant_sdk_upgrade_ab_test_bucket: :default, analytics_id: 'Doc Auth', flow_path: 'hybrid', irs_reproofing: false, step: 'document_capture', - } + }.merge(ab_test_args) end it 'renders the show template' do @@ -132,8 +137,7 @@ flow_path: 'hybrid', irs_reproofing: false, step: 'document_capture', - acuant_sdk_upgrade_ab_test_bucket: :default, - } + }.merge(ab_test_args) end before do diff --git a/spec/controllers/idv/in_person/ssn_controller_spec.rb b/spec/controllers/idv/in_person/ssn_controller_spec.rb index fea0ab023ee..d8c5067e72e 100644 --- a/spec/controllers/idv/in_person/ssn_controller_spec.rb +++ b/spec/controllers/idv/in_person/ssn_controller_spec.rb @@ -14,12 +14,17 @@ let(:user) { create(:user) } + let(:ab_test_args) do + { sample_bucket1: :sample_value1, sample_bucket2: :sample_value2 } + end + before do stub_sign_in(user) subject.user_session['idv/in_person'] = flow_session stub_analytics stub_attempts_tracker allow(@analytics).to receive(:track_event) + allow(subject).to receive(:ab_test_analytics_args).and_return(ab_test_args) end describe 'before_actions' do @@ -88,7 +93,7 @@ flow_path: 'standard', irs_reproofing: false, step: 'ssn', - } + }.merge(ab_test_args) end it 'renders the show template' do diff --git a/spec/controllers/idv/in_person/verify_info_controller_spec.rb b/spec/controllers/idv/in_person/verify_info_controller_spec.rb index c19ca5bfaf6..66eb64e6d4b 100644 --- a/spec/controllers/idv/in_person/verify_info_controller_spec.rb +++ b/spec/controllers/idv/in_person/verify_info_controller_spec.rb @@ -13,9 +13,14 @@ let(:user) { build(:user, :with_phone, with: { phone: '+1 (415) 555-0130' }) } let(:service_provider) { create(:service_provider) } + let(:ab_test_args) do + { sample_bucket1: :sample_value1, sample_bucket2: :sample_value2 } + end + before do allow(subject).to receive(:flow_session).and_return(flow_session) stub_sign_in(user) + allow(subject).to receive(:ab_test_analytics_args).and_return(ab_test_args) end describe 'before_actions' do @@ -64,7 +69,7 @@ step: 'verify', same_address_as_id: true, pii_like_keypaths: [[:same_address_as_id], [:state_id, :state_id_jurisdiction]], - } + }.merge(ab_test_args) end it 'renders the show template' do diff --git a/spec/controllers/idv/link_sent_controller_spec.rb b/spec/controllers/idv/link_sent_controller_spec.rb index 9a4268d8411..bdcd64819dd 100644 --- a/spec/controllers/idv/link_sent_controller_spec.rb +++ b/spec/controllers/idv/link_sent_controller_spec.rb @@ -4,12 +4,16 @@ include IdvHelper let(:flow_session) do - { 'document_capture_session_uuid' => 'fd14e181-6fb1-4cdc-92e0-ef66dad0df4e', - :threatmetrix_session_id => 'c90ae7a5-6629-4e77-b97c-f1987c2df7d0' } + { document_capture_session_uuid: 'fd14e181-6fb1-4cdc-92e0-ef66dad0df4e', + threatmetrix_session_id: 'c90ae7a5-6629-4e77-b97c-f1987c2df7d0' } end let(:user) { create(:user) } + let(:ab_test_args) do + { sample_bucket1: :sample_value1, sample_bucket2: :sample_value2 } + end + before do allow(subject).to receive(:flow_session).and_return(flow_session) stub_sign_in(user) @@ -17,6 +21,7 @@ stub_analytics stub_attempts_tracker allow(@analytics).to receive(:track_event) + allow(subject).to receive(:ab_test_analytics_args).and_return(ab_test_args) end describe 'before_actions' do @@ -50,7 +55,7 @@ flow_path: 'hybrid', irs_reproofing: false, step: 'link_sent', - } + }.merge(ab_test_args) end it 'renders the show template' do @@ -113,7 +118,7 @@ flow_path: 'hybrid', irs_reproofing: false, step: 'link_sent', - } + }.merge(ab_test_args) end it 'sends analytics_submitted event' do diff --git a/spec/controllers/idv/ssn_controller_spec.rb b/spec/controllers/idv/ssn_controller_spec.rb index e09163a90ed..833eb9abbd8 100644 --- a/spec/controllers/idv/ssn_controller_spec.rb +++ b/spec/controllers/idv/ssn_controller_spec.rb @@ -13,6 +13,10 @@ let(:user) { create(:user) } + let(:ab_test_args) do + { sample_bucket1: :sample_value1, sample_bucket2: :sample_value2 } + end + before do stub_sign_in(user) subject.user_session['idv/doc_auth'] = flow_session @@ -20,6 +24,7 @@ stub_analytics stub_attempts_tracker allow(@analytics).to receive(:track_event) + allow(subject).to receive(:ab_test_analytics_args).and_return(ab_test_args) end describe 'before_actions' do @@ -60,7 +65,7 @@ flow_path: 'standard', irs_reproofing: false, step: 'ssn', - } + }.merge(ab_test_args) end it 'renders the show template' do @@ -166,7 +171,7 @@ success: true, errors: {}, pii_like_keypaths: [[:errors, :ssn], [:error_details, :ssn]], - } + }.merge(ab_test_args) end it 'merges ssn into pii session value' do @@ -242,7 +247,7 @@ }, error_details: { ssn: [:invalid] }, pii_like_keypaths: [[:errors, :ssn], [:error_details, :ssn]], - } + }.merge(ab_test_args) end render_views diff --git a/spec/controllers/idv/verify_info_controller_spec.rb b/spec/controllers/idv/verify_info_controller_spec.rb index 8a96ceea9e8..3287af35c1b 100644 --- a/spec/controllers/idv/verify_info_controller_spec.rb +++ b/spec/controllers/idv/verify_info_controller_spec.rb @@ -17,7 +17,11 @@ flow_path: 'standard', irs_reproofing: false, step: 'verify', - } + }.merge(ab_test_args) + end + + let(:ab_test_args) do + { sample_bucket1: :sample_value1, sample_bucket2: :sample_value2 } end before do @@ -26,6 +30,7 @@ stub_idv_steps_before_verify_step(user) subject.idv_session.flow_path = 'standard' subject.user_session['idv/doc_auth'] = flow_session + allow(subject).to receive(:ab_test_analytics_args).and_return(ab_test_args) end describe 'before_actions' do @@ -59,7 +64,7 @@ flow_path: 'standard', irs_reproofing: false, step: 'verify', - } + }.merge(ab_test_args) end it 'renders the show template' do From cfc9bedf54ffaaf034f6ec65fcad58f0555ec755 Mon Sep 17 00:00:00 2001 From: Sonia Connolly Date: Thu, 20 Jul 2023 13:01:43 -0700 Subject: [PATCH 08/20] Update analytics_spec with getting started analytics bucket This spec will still need to be updated by hand whenever A/B test analytics are added or removed. --- spec/features/idv/analytics_spec.rb | 42 ++++++++++++++--------------- 1 file changed, 21 insertions(+), 21 deletions(-) diff --git a/spec/features/idv/analytics_spec.rb b/spec/features/idv/analytics_spec.rb index 37bb9259006..42bf32c088f 100644 --- a/spec/features/idv/analytics_spec.rb +++ b/spec/features/idv/analytics_spec.rb @@ -37,18 +37,18 @@ 'IdV: doc auth agreement visited' => { step: 'agreement', analytics_id: 'Doc Auth', irs_reproofing: false }, 'IdV: consent checkbox toggled' => { checked: true }, 'IdV: doc auth agreement submitted' => { success: true, errors: {}, step: 'agreement', analytics_id: 'Doc Auth', irs_reproofing: false }, - 'IdV: doc auth hybrid handoff visited' => { step: 'hybrid_handoff', acuant_sdk_upgrade_ab_test_bucket: :default, analytics_id: 'Doc Auth', irs_reproofing: false }, - 'IdV: doc auth hybrid handoff submitted' => { success: true, errors: {}, destination: :document_capture, flow_path: 'standard', step: 'hybrid_handoff', acuant_sdk_upgrade_ab_test_bucket: :default, analytics_id: 'Doc Auth', irs_reproofing: false, skip_upload_step: false }, - 'IdV: doc auth document_capture visited' => { flow_path: 'standard', step: 'document_capture', acuant_sdk_upgrade_ab_test_bucket: :default, analytics_id: 'Doc Auth', irs_reproofing: false }, + 'IdV: doc auth hybrid handoff visited' => { step: 'hybrid_handoff', :acuant_sdk_upgrade_ab_test_bucket=>:default, :getting_started_ab_test_bucket=>:welcome, analytics_id: 'Doc Auth', irs_reproofing: false }, + 'IdV: doc auth hybrid handoff submitted' => { success: true, errors: {}, destination: :document_capture, flow_path: 'standard', step: 'hybrid_handoff', :acuant_sdk_upgrade_ab_test_bucket=>:default, :getting_started_ab_test_bucket=>:welcome, analytics_id: 'Doc Auth', irs_reproofing: false, skip_upload_step: false }, + 'IdV: doc auth document_capture visited' => { flow_path: 'standard', step: 'document_capture', :acuant_sdk_upgrade_ab_test_bucket=>:default, :getting_started_ab_test_bucket=>:welcome, analytics_id: 'Doc Auth', irs_reproofing: false }, 'Frontend: IdV: front image added' => { 'width' => 284, 'height' => 38, 'mimeType' => 'image/png', 'source' => 'upload', 'size' => 3694, 'attempt' => 1, 'flow_path' => 'standard', 'acuant_sdk_upgrade_a_b_testing_enabled' => 'false', 'use_alternate_sdk' => anything, 'acuant_version' => anything }, 'Frontend: IdV: back image added' => { 'width' => 284, 'height' => 38, 'mimeType' => 'image/png', 'source' => 'upload', 'size' => 3694, 'attempt' => 1, 'flow_path' => 'standard', 'acuant_sdk_upgrade_a_b_testing_enabled' => 'false', 'use_alternate_sdk' => anything, 'acuant_version' => anything }, 'IdV: doc auth image upload form submitted' => { success: true, errors: {}, attempts: 1, remaining_attempts: 3, user_id: user.uuid, flow_path: 'standard', front_image_fingerprint: an_instance_of(String), back_image_fingerprint: an_instance_of(String) }, 'IdV: doc auth image upload vendor pii validation' => { success: true, errors: {}, user_id: user.uuid, attempts: 1, remaining_attempts: 3, flow_path: 'standard', attention_with_barcode: false, front_image_fingerprint: an_instance_of(String), back_image_fingerprint: an_instance_of(String) }, - 'IdV: doc auth document_capture submitted' => { success: true, errors: {}, flow_path: 'standard', step: 'document_capture', acuant_sdk_upgrade_ab_test_bucket: :default, analytics_id: 'Doc Auth', irs_reproofing: false }, - 'IdV: doc auth ssn visited' => { flow_path: 'standard', step: 'ssn', acuant_sdk_upgrade_ab_test_bucket: :default, analytics_id: 'Doc Auth', irs_reproofing: false }, - 'IdV: doc auth ssn submitted' => { success: true, errors: {}, flow_path: 'standard', step: 'ssn', acuant_sdk_upgrade_ab_test_bucket: :default, analytics_id: 'Doc Auth', irs_reproofing: false }, - 'IdV: doc auth verify visited' => { flow_path: 'standard', step: 'verify', acuant_sdk_upgrade_ab_test_bucket: :default, analytics_id: 'Doc Auth', irs_reproofing: false }, - 'IdV: doc auth verify submitted' => { flow_path: 'standard', step: 'verify', acuant_sdk_upgrade_ab_test_bucket: :default, analytics_id: 'Doc Auth', irs_reproofing: false }, + 'IdV: doc auth document_capture submitted' => { success: true, errors: {}, flow_path: 'standard', step: 'document_capture', :acuant_sdk_upgrade_ab_test_bucket=>:default, :getting_started_ab_test_bucket=>:welcome, analytics_id: 'Doc Auth', irs_reproofing: false }, + 'IdV: doc auth ssn visited' => { flow_path: 'standard', step: 'ssn', :acuant_sdk_upgrade_ab_test_bucket=>:default, :getting_started_ab_test_bucket=>:welcome, analytics_id: 'Doc Auth', irs_reproofing: false }, + 'IdV: doc auth ssn submitted' => { success: true, errors: {}, flow_path: 'standard', step: 'ssn', :acuant_sdk_upgrade_ab_test_bucket=>:default, :getting_started_ab_test_bucket=>:welcome, analytics_id: 'Doc Auth', irs_reproofing: false }, + 'IdV: doc auth verify visited' => { flow_path: 'standard', step: 'verify', :acuant_sdk_upgrade_ab_test_bucket=>:default, :getting_started_ab_test_bucket=>:welcome, analytics_id: 'Doc Auth', irs_reproofing: false }, + 'IdV: doc auth verify submitted' => { flow_path: 'standard', step: 'verify', :acuant_sdk_upgrade_ab_test_bucket=>:default, :getting_started_ab_test_bucket=>:welcome, analytics_id: 'Doc Auth', irs_reproofing: false }, 'IdV: doc auth verify proofing results' => { success: true, errors: {}, address_edited: false, address_line2_present: false, ssn_is_unique: true, proofing_results: { exception: nil, timed_out: false, threatmetrix_review_status: 'pass', context: { device_profiling_adjudication_reason: 'device_profiling_result_pass', double_address_verification: false, resolution_adjudication_reason: 'pass_resolution_and_state_id', should_proof_state_id: true, stages: { resolution: { success: true, errors: {}, exception: nil, timed_out: false, transaction_id: 'resolution-mock-transaction-id-123', reference: 'aaa-bbb-ccc', can_pass_with_additional_verification: false, attributes_requiring_additional_verification: [], vendor_name: 'ResolutionMock', vendor_workflow: nil }, residential_address: { errors: {}, exception: nil, reference: '', success: true, timed_out: false, transaction_id: '', vendor_name: 'ResidentialAddressNotRequired' }, state_id: { success: true, errors: {}, exception: nil, mva_exception: nil, timed_out: false, transaction_id: 'state-id-mock-transaction-id-456', vendor_name: 'StateIdMock', verified_attributes: [], state: 'MT', state_id_jurisdiction: 'ND', state_id_number: '#############' }, threatmetrix: threatmetrix_response } } } }, 'IdV: phone of record visited' => { proofing_components: { document_check: 'mock', document_type: 'state_id', source_check: 'aamva', resolution_check: 'lexis_nexis', threatmetrix: threatmetrix, threatmetrix_review_status: 'pass' } }, 'IdV: phone confirmation form' => { success: true, errors: {}, phone_type: :mobile, types: [:fixed_or_mobile], carrier: 'Test Mobile Carrier', country_code: 'US', area_code: '202', proofing_components: { document_check: 'mock', document_type: 'state_id', source_check: 'aamva', resolution_check: 'lexis_nexis', threatmetrix: threatmetrix, threatmetrix_review_status: 'pass' }, otp_delivery_preference: 'sms' }, @@ -72,18 +72,18 @@ 'IdV: doc auth welcome submitted' => { step: 'welcome', analytics_id: 'Doc Auth', irs_reproofing: false }, 'IdV: doc auth agreement visited' => { step: 'agreement', analytics_id: 'Doc Auth', irs_reproofing: false }, 'IdV: doc auth agreement submitted' => { success: true, errors: {}, step: 'agreement', analytics_id: 'Doc Auth', irs_reproofing: false }, - 'IdV: doc auth hybrid handoff visited' => { step: 'hybrid_handoff', acuant_sdk_upgrade_ab_test_bucket: :default, analytics_id: 'Doc Auth', irs_reproofing: false }, - 'IdV: doc auth hybrid handoff submitted' => { success: true, errors: {}, destination: :document_capture, flow_path: 'standard', step: 'hybrid_handoff', acuant_sdk_upgrade_ab_test_bucket: :default, analytics_id: 'Doc Auth', irs_reproofing: false, skip_upload_step: false }, - 'IdV: doc auth document_capture visited' => { flow_path: 'standard', step: 'document_capture', acuant_sdk_upgrade_ab_test_bucket: :default, analytics_id: 'Doc Auth', irs_reproofing: false }, + 'IdV: doc auth hybrid handoff visited' => { step: 'hybrid_handoff', :acuant_sdk_upgrade_ab_test_bucket=>:default, :getting_started_ab_test_bucket=>:welcome, analytics_id: 'Doc Auth', irs_reproofing: false }, + 'IdV: doc auth hybrid handoff submitted' => { success: true, errors: {}, destination: :document_capture, flow_path: 'standard', step: 'hybrid_handoff', :acuant_sdk_upgrade_ab_test_bucket=>:default, :getting_started_ab_test_bucket=>:welcome, analytics_id: 'Doc Auth', irs_reproofing: false, skip_upload_step: false }, + 'IdV: doc auth document_capture visited' => { flow_path: 'standard', step: 'document_capture', :acuant_sdk_upgrade_ab_test_bucket=>:default, :getting_started_ab_test_bucket=>:welcome, analytics_id: 'Doc Auth', irs_reproofing: false }, 'Frontend: IdV: front image added' => { 'width' => 284, 'height' => 38, 'mimeType' => 'image/png', 'source' => 'upload', 'size' => 3694, 'attempt' => 1, 'flow_path' => 'standard', 'acuant_sdk_upgrade_a_b_testing_enabled' => 'false', 'use_alternate_sdk' => anything, 'acuant_version' => anything }, 'Frontend: IdV: back image added' => { 'width' => 284, 'height' => 38, 'mimeType' => 'image/png', 'source' => 'upload', 'size' => 3694, 'attempt' => 1, 'flow_path' => 'standard', 'acuant_sdk_upgrade_a_b_testing_enabled' => 'false', 'use_alternate_sdk' => anything, 'acuant_version' => anything }, 'IdV: doc auth image upload form submitted' => { success: true, errors: {}, attempts: 1, remaining_attempts: 3, user_id: user.uuid, flow_path: 'standard', front_image_fingerprint: an_instance_of(String), back_image_fingerprint: an_instance_of(String) }, 'IdV: doc auth image upload vendor pii validation' => { success: true, errors: {}, user_id: user.uuid, attempts: 1, remaining_attempts: 3, flow_path: 'standard', attention_with_barcode: false, front_image_fingerprint: an_instance_of(String), back_image_fingerprint: an_instance_of(String) }, - 'IdV: doc auth document_capture submitted' => { success: true, errors: {}, flow_path: 'standard', step: 'document_capture', acuant_sdk_upgrade_ab_test_bucket: :default, analytics_id: 'Doc Auth', irs_reproofing: false }, - 'IdV: doc auth ssn visited' => { flow_path: 'standard', step: 'ssn', acuant_sdk_upgrade_ab_test_bucket: :default, analytics_id: 'Doc Auth', irs_reproofing: false }, - 'IdV: doc auth ssn submitted' => { success: true, errors: {}, flow_path: 'standard', step: 'ssn', acuant_sdk_upgrade_ab_test_bucket: :default, analytics_id: 'Doc Auth', irs_reproofing: false }, - 'IdV: doc auth verify visited' => { flow_path: 'standard', step: 'verify', acuant_sdk_upgrade_ab_test_bucket: :default, analytics_id: 'Doc Auth', irs_reproofing: false }, - 'IdV: doc auth verify submitted' => { flow_path: 'standard', step: 'verify', acuant_sdk_upgrade_ab_test_bucket: :default, analytics_id: 'Doc Auth', irs_reproofing: false }, + 'IdV: doc auth document_capture submitted' => { success: true, errors: {}, flow_path: 'standard', step: 'document_capture', :acuant_sdk_upgrade_ab_test_bucket=>:default, :getting_started_ab_test_bucket=>:welcome, analytics_id: 'Doc Auth', irs_reproofing: false }, + 'IdV: doc auth ssn visited' => { flow_path: 'standard', step: 'ssn', :acuant_sdk_upgrade_ab_test_bucket=>:default, :getting_started_ab_test_bucket=>:welcome, analytics_id: 'Doc Auth', irs_reproofing: false }, + 'IdV: doc auth ssn submitted' => { success: true, errors: {}, flow_path: 'standard', step: 'ssn', :acuant_sdk_upgrade_ab_test_bucket=>:default, :getting_started_ab_test_bucket=>:welcome, analytics_id: 'Doc Auth', irs_reproofing: false }, + 'IdV: doc auth verify visited' => { flow_path: 'standard', step: 'verify', :acuant_sdk_upgrade_ab_test_bucket=>:default, :getting_started_ab_test_bucket=>:welcome, analytics_id: 'Doc Auth', irs_reproofing: false }, + 'IdV: doc auth verify submitted' => { flow_path: 'standard', step: 'verify', :acuant_sdk_upgrade_ab_test_bucket=>:default, :getting_started_ab_test_bucket=>:welcome, analytics_id: 'Doc Auth', irs_reproofing: false }, 'IdV: doc auth verify proofing results' => { success: true, errors: {}, address_edited: false, address_line2_present: false, ssn_is_unique: true, proofing_results: { exception: nil, timed_out: false, threatmetrix_review_status: 'pass', context: { device_profiling_adjudication_reason: 'device_profiling_result_pass', resolution_adjudication_reason: 'pass_resolution_and_state_id', double_address_verification: false, should_proof_state_id: true, stages: { resolution: { success: true, errors: {}, exception: nil, timed_out: false, transaction_id: 'resolution-mock-transaction-id-123', reference: 'aaa-bbb-ccc', can_pass_with_additional_verification: false, attributes_requiring_additional_verification: [], vendor_name: 'ResolutionMock', vendor_workflow: nil }, residential_address: { errors: {}, exception: nil, reference: '', success: true, timed_out: false, transaction_id: '', vendor_name: 'ResidentialAddressNotRequired' }, state_id: { success: true, errors: {}, exception: nil, mva_exception: nil, timed_out: false, transaction_id: 'state-id-mock-transaction-id-456', vendor_name: 'StateIdMock', verified_attributes: [], state: 'MT', state_id_jurisdiction: 'ND', state_id_number: '#############' }, threatmetrix: threatmetrix_response } } } }, 'IdV: phone of record visited' => { proofing_components: { document_check: 'mock', document_type: 'state_id', source_check: 'aamva', resolution_check: 'lexis_nexis', threatmetrix: threatmetrix, threatmetrix_review_status: 'pass' } }, 'IdV: USPS address letter requested' => { resend: false, proofing_components: { document_check: 'mock', document_type: 'state_id', source_check: 'aamva', resolution_check: 'lexis_nexis', threatmetrix: threatmetrix, threatmetrix_review_status: 'pass' } }, @@ -101,9 +101,9 @@ 'IdV: doc auth welcome submitted' => { step: 'welcome', analytics_id: 'Doc Auth', irs_reproofing: false }, 'IdV: doc auth agreement visited' => { step: 'agreement', analytics_id: 'Doc Auth', irs_reproofing: false }, 'IdV: doc auth agreement submitted' => { success: true, errors: {}, step: 'agreement', analytics_id: 'Doc Auth', irs_reproofing: false }, - 'IdV: doc auth hybrid handoff visited' => { step: 'hybrid_handoff', acuant_sdk_upgrade_ab_test_bucket: :default, analytics_id: 'Doc Auth', irs_reproofing: false }, - 'IdV: doc auth hybrid handoff submitted' => { success: true, errors: {}, destination: :document_capture, flow_path: 'standard', step: 'hybrid_handoff', acuant_sdk_upgrade_ab_test_bucket: :default, analytics_id: 'Doc Auth', irs_reproofing: false, skip_upload_step: false }, - 'IdV: doc auth document_capture visited' => { flow_path: 'standard', step: 'document_capture', acuant_sdk_upgrade_ab_test_bucket: :default, analytics_id: 'Doc Auth', irs_reproofing: false }, + 'IdV: doc auth hybrid handoff visited' => { step: 'hybrid_handoff', :acuant_sdk_upgrade_ab_test_bucket=>:default, :getting_started_ab_test_bucket=>:welcome, analytics_id: 'Doc Auth', irs_reproofing: false }, + 'IdV: doc auth hybrid handoff submitted' => { success: true, errors: {}, destination: :document_capture, flow_path: 'standard', step: 'hybrid_handoff', :acuant_sdk_upgrade_ab_test_bucket=>:default, :getting_started_ab_test_bucket=>:welcome, analytics_id: 'Doc Auth', irs_reproofing: false, skip_upload_step: false }, + 'IdV: doc auth document_capture visited' => { flow_path: 'standard', step: 'document_capture', :acuant_sdk_upgrade_ab_test_bucket=>:default, :getting_started_ab_test_bucket=>:welcome, analytics_id: 'Doc Auth', irs_reproofing: false }, 'Frontend: IdV: front image added' => { 'width' => 284, 'height' => 38, 'mimeType' => 'image/png', 'source' => 'upload', 'size' => 3694, 'attempt' => 1, 'flow_path' => 'standard', 'acuant_sdk_upgrade_a_b_testing_enabled' => 'false', 'use_alternate_sdk' => anything, 'acuant_version' => anything }, 'Frontend: IdV: back image added' => { 'width' => 284, 'height' => 38, 'mimeType' => 'image/png', 'source' => 'upload', 'size' => 3694, 'attempt' => 1, 'flow_path' => 'standard', 'acuant_sdk_upgrade_a_b_testing_enabled' => 'false', 'use_alternate_sdk' => anything, 'acuant_version' => anything }, 'IdV: doc auth image upload form submitted' => { success: true, errors: {}, attempts: 1, remaining_attempts: 3, user_id: user.uuid, flow_path: 'standard', front_image_fingerprint: an_instance_of(String), back_image_fingerprint: an_instance_of(String) }, @@ -119,8 +119,8 @@ 'IdV: in person proofing address submitted' => { success: true, step: 'address', flow_path: 'standard', step_count: 1, analytics_id: 'In Person Proofing', irs_reproofing: false, errors: {}, same_address_as_id: true }, 'IdV: doc auth ssn visited' => { analytics_id: 'In Person Proofing', step: 'ssn', flow_path: 'standard', step_count: 1, irs_reproofing: false, same_address_as_id: true }, 'IdV: doc auth ssn submitted' => { analytics_id: 'In Person Proofing', success: true, step: 'ssn', flow_path: 'standard', step_count: 1, irs_reproofing: false, errors: {}, same_address_as_id: true }, - 'IdV: doc auth verify visited' => { analytics_id: 'In Person Proofing', step: 'verify', flow_path: 'standard', irs_reproofing: false, same_address_as_id: true }, - 'IdV: doc auth verify submitted' => { analytics_id: 'In Person Proofing', step: 'verify', flow_path: 'standard', irs_reproofing: false, same_address_as_id: true }, + 'IdV: doc auth verify visited' => { analytics_id: 'In Person Proofing', step: 'verify', flow_path: 'standard', irs_reproofing: false, same_address_as_id: true, getting_started_ab_test_bucket: :welcome }, + 'IdV: doc auth verify submitted' => { analytics_id: 'In Person Proofing', step: 'verify', flow_path: 'standard', irs_reproofing: false, same_address_as_id: true, getting_started_ab_test_bucket: :welcome }, 'IdV: doc auth verify proofing results' => { success: true, errors: {}, address_edited: false, address_line2_present: false, ssn_is_unique: true, proofing_results: { exception: nil, timed_out: false, threatmetrix_review_status: 'pass', context: { device_profiling_adjudication_reason: 'device_profiling_result_pass', double_address_verification: false, resolution_adjudication_reason: 'pass_resolution_and_state_id', should_proof_state_id: true, stages: { resolution: { success: true, errors: {}, exception: nil, timed_out: false, transaction_id: 'resolution-mock-transaction-id-123', reference: 'aaa-bbb-ccc', can_pass_with_additional_verification: false, attributes_requiring_additional_verification: [], vendor_name: 'ResolutionMock', vendor_workflow: nil }, residential_address: { errors: {}, exception: nil, reference: '', success: true, timed_out: false, transaction_id: '', vendor_name: 'ResidentialAddressNotRequired' }, state_id: { success: true, errors: {}, exception: nil, mva_exception: nil, timed_out: false, transaction_id: 'state-id-mock-transaction-id-456', vendor_name: 'StateIdMock', verified_attributes: [], state: 'MT', state_id_jurisdiction: 'ND', state_id_number: '#############' }, threatmetrix: threatmetrix_response } } } }, 'IdV: phone confirmation form' => { success: true, errors: {}, phone_type: :mobile, types: [:fixed_or_mobile], carrier: 'Test Mobile Carrier', country_code: 'US', area_code: '202', proofing_components: { document_check: 'usps', resolution_check: 'lexis_nexis', threatmetrix: threatmetrix, threatmetrix_review_status: 'pass', source_check: 'aamva' }, otp_delivery_preference: 'sms' }, 'IdV: phone confirmation vendor' => { success: true, errors: {}, vendor: { exception: nil, vendor_name: 'AddressMock', transaction_id: 'address-mock-transaction-id-123', timed_out: false, reference: '' }, new_phone_added: false, proofing_components: { address_check: 'lexis_nexis_address', document_check: 'usps', resolution_check: 'lexis_nexis', threatmetrix: threatmetrix, threatmetrix_review_status: 'pass', source_check: 'aamva' }, area_code: '202', country_code: 'US', phone_fingerprint: anything }, From 6d4ae6d543161717f8c5b8dc2fba34cc97d0c7d2 Mon Sep 17 00:00:00 2001 From: Sonia Connolly Date: Thu, 20 Jul 2023 13:08:13 -0700 Subject: [PATCH 09/20] Rename getting_started_a_b_test_bucket to getting_started_ab_test_bucket for consistency --- .../concerns/idv/getting_started_ab_test_concern.rb | 6 +++--- .../idv/getting_started_ab_test_concern_spec.rb | 12 ++++++------ 2 files changed, 9 insertions(+), 9 deletions(-) diff --git a/app/controllers/concerns/idv/getting_started_ab_test_concern.rb b/app/controllers/concerns/idv/getting_started_ab_test_concern.rb index c28d2821d2c..5a9b3ce84f1 100644 --- a/app/controllers/concerns/idv/getting_started_ab_test_concern.rb +++ b/app/controllers/concerns/idv/getting_started_ab_test_concern.rb @@ -1,11 +1,11 @@ module Idv module GettingStartedAbTestConcern - def getting_started_a_b_test_bucket + def getting_started_ab_test_bucket AbTests::IDV_GETTING_STARTED.bucket(current_user&.uuid) end def maybe_redirect_for_getting_started_ab_test - return if getting_started_a_b_test_bucket != :getting_started + return if getting_started_ab_test_bucket != :getting_started redirect_to idv_getting_started_url end @@ -15,7 +15,7 @@ def getting_started_ab_test_analytics_args { getting_started_ab_test_bucket: - getting_started_a_b_test_bucket, + getting_started_ab_test_bucket, } end end diff --git a/spec/controllers/concerns/idv/getting_started_ab_test_concern_spec.rb b/spec/controllers/concerns/idv/getting_started_ab_test_concern_spec.rb index 7ed634841c6..74d0dc4fb75 100644 --- a/spec/controllers/concerns/idv/getting_started_ab_test_concern_spec.rb +++ b/spec/controllers/concerns/idv/getting_started_ab_test_concern_spec.rb @@ -13,7 +13,7 @@ def show end end - describe '#getting_started_a_b_test_bucket' do + describe '#getting_started_ab_test_bucket' do controller Idv::StepController do end @@ -29,7 +29,7 @@ def show end it 'returns the bucket based on user id' do - expect(controller.getting_started_a_b_test_bucket).to eq(:getting_started) + expect(controller.getting_started_ab_test_bucket).to eq(:getting_started) end context 'with a different user' do @@ -38,7 +38,7 @@ def show allow(controller).to receive(:current_user).and_return(user2) end it 'returns the bucket based on request id' do - expect(controller.getting_started_a_b_test_bucket).to eq(:welcome) + expect(controller.getting_started_ab_test_bucket).to eq(:welcome) end end end @@ -57,7 +57,7 @@ def show context 'A/B test specifies getting started page' do before do - allow(controller).to receive(:getting_started_a_b_test_bucket). + allow(controller).to receive(:getting_started_ab_test_bucket). and_return(:getting_started) end @@ -70,7 +70,7 @@ def show context 'A/B test specifies welcome page' do before do - allow(controller).to receive(:getting_started_a_b_test_bucket). + allow(controller).to receive(:getting_started_ab_test_bucket). and_return(:welcome) end @@ -84,7 +84,7 @@ def show context 'A/B test specifies some other value' do before do - allow(controller).to receive(:getting_started_a_b_test_bucket). + allow(controller).to receive(:getting_started_ab_test_bucket). and_return(:something_else) end From 18a5cd39d558f7ba1574ad3f243e4d5bc52fe21d Mon Sep 17 00:00:00 2001 From: Sonia Connolly Date: Thu, 20 Jul 2023 13:31:17 -0700 Subject: [PATCH 10/20] Collect ab test analytics methods in AbTestAnalyticsConcern rather than including other concerns changelog: Improvements, Logging, Generalize analytics logging for A/B tests in Identity Verification and add logging for Getting Started A/B test --- .../concerns/idv/ab_test_analytics_concern.rb | 21 ++++++++++++++++--- .../concerns/idv/acuant_concern.rb | 9 -------- .../idv/getting_started_ab_test_concern.rb | 9 -------- 3 files changed, 18 insertions(+), 21 deletions(-) diff --git a/app/controllers/concerns/idv/ab_test_analytics_concern.rb b/app/controllers/concerns/idv/ab_test_analytics_concern.rb index 7391b45a02d..aca8bc4559b 100644 --- a/app/controllers/concerns/idv/ab_test_analytics_concern.rb +++ b/app/controllers/concerns/idv/ab_test_analytics_concern.rb @@ -1,11 +1,26 @@ module Idv module AbTestAnalyticsConcern - include AcuantConcern - include Idv::GettingStartedAbTestConcern - def ab_test_analytics_args acuant_sdk_ab_test_analytics_args. merge(getting_started_ab_test_analytics_args) end + + def acuant_sdk_ab_test_analytics_args + return {} if document_capture_session_uuid.blank? + + { + acuant_sdk_upgrade_ab_test_bucket: + AbTests::ACUANT_SDK.bucket(document_capture_session_uuid), + } + end + + def getting_started_ab_test_analytics_args + return {} if current_user.blank? + + { + getting_started_ab_test_bucket: + getting_started_ab_test_bucket, + } + end end end diff --git a/app/controllers/concerns/idv/acuant_concern.rb b/app/controllers/concerns/idv/acuant_concern.rb index 68dd8920431..cb3113db692 100644 --- a/app/controllers/concerns/idv/acuant_concern.rb +++ b/app/controllers/concerns/idv/acuant_concern.rb @@ -1,14 +1,5 @@ module Idv module AcuantConcern - def acuant_sdk_ab_test_analytics_args - return {} if document_capture_session_uuid.blank? - - { - acuant_sdk_upgrade_ab_test_bucket: - AbTests::ACUANT_SDK.bucket(document_capture_session_uuid), - } - end - def acuant_sdk_upgrade_a_b_testing_variables bucket = AbTests::ACUANT_SDK.bucket(document_capture_session_uuid) testing_enabled = IdentityConfig.store.idv_acuant_sdk_upgrade_a_b_testing_enabled diff --git a/app/controllers/concerns/idv/getting_started_ab_test_concern.rb b/app/controllers/concerns/idv/getting_started_ab_test_concern.rb index 5a9b3ce84f1..9ed21b194cb 100644 --- a/app/controllers/concerns/idv/getting_started_ab_test_concern.rb +++ b/app/controllers/concerns/idv/getting_started_ab_test_concern.rb @@ -9,14 +9,5 @@ def maybe_redirect_for_getting_started_ab_test redirect_to idv_getting_started_url end - - def getting_started_ab_test_analytics_args - return {} if current_user.blank? - - { - getting_started_ab_test_bucket: - getting_started_ab_test_bucket, - } - end end end From b767285b1378dfe5bf5205d143ee5b3f44a1b3f8 Mon Sep 17 00:00:00 2001 From: Sonia Connolly Date: Thu, 20 Jul 2023 13:34:45 -0700 Subject: [PATCH 11/20] lint --- spec/features/idv/analytics_spec.rb | 38 ++++++++++++++--------------- 1 file changed, 19 insertions(+), 19 deletions(-) diff --git a/spec/features/idv/analytics_spec.rb b/spec/features/idv/analytics_spec.rb index 42bf32c088f..08f747de1bd 100644 --- a/spec/features/idv/analytics_spec.rb +++ b/spec/features/idv/analytics_spec.rb @@ -37,18 +37,18 @@ 'IdV: doc auth agreement visited' => { step: 'agreement', analytics_id: 'Doc Auth', irs_reproofing: false }, 'IdV: consent checkbox toggled' => { checked: true }, 'IdV: doc auth agreement submitted' => { success: true, errors: {}, step: 'agreement', analytics_id: 'Doc Auth', irs_reproofing: false }, - 'IdV: doc auth hybrid handoff visited' => { step: 'hybrid_handoff', :acuant_sdk_upgrade_ab_test_bucket=>:default, :getting_started_ab_test_bucket=>:welcome, analytics_id: 'Doc Auth', irs_reproofing: false }, - 'IdV: doc auth hybrid handoff submitted' => { success: true, errors: {}, destination: :document_capture, flow_path: 'standard', step: 'hybrid_handoff', :acuant_sdk_upgrade_ab_test_bucket=>:default, :getting_started_ab_test_bucket=>:welcome, analytics_id: 'Doc Auth', irs_reproofing: false, skip_upload_step: false }, - 'IdV: doc auth document_capture visited' => { flow_path: 'standard', step: 'document_capture', :acuant_sdk_upgrade_ab_test_bucket=>:default, :getting_started_ab_test_bucket=>:welcome, analytics_id: 'Doc Auth', irs_reproofing: false }, + 'IdV: doc auth hybrid handoff visited' => { step: 'hybrid_handoff', acuant_sdk_upgrade_ab_test_bucket: :default, getting_started_ab_test_bucket: :welcome, analytics_id: 'Doc Auth', irs_reproofing: false }, + 'IdV: doc auth hybrid handoff submitted' => { success: true, errors: {}, destination: :document_capture, flow_path: 'standard', step: 'hybrid_handoff', acuant_sdk_upgrade_ab_test_bucket: :default, getting_started_ab_test_bucket: :welcome, analytics_id: 'Doc Auth', irs_reproofing: false, skip_upload_step: false }, + 'IdV: doc auth document_capture visited' => { flow_path: 'standard', step: 'document_capture', acuant_sdk_upgrade_ab_test_bucket: :default, getting_started_ab_test_bucket: :welcome, analytics_id: 'Doc Auth', irs_reproofing: false }, 'Frontend: IdV: front image added' => { 'width' => 284, 'height' => 38, 'mimeType' => 'image/png', 'source' => 'upload', 'size' => 3694, 'attempt' => 1, 'flow_path' => 'standard', 'acuant_sdk_upgrade_a_b_testing_enabled' => 'false', 'use_alternate_sdk' => anything, 'acuant_version' => anything }, 'Frontend: IdV: back image added' => { 'width' => 284, 'height' => 38, 'mimeType' => 'image/png', 'source' => 'upload', 'size' => 3694, 'attempt' => 1, 'flow_path' => 'standard', 'acuant_sdk_upgrade_a_b_testing_enabled' => 'false', 'use_alternate_sdk' => anything, 'acuant_version' => anything }, 'IdV: doc auth image upload form submitted' => { success: true, errors: {}, attempts: 1, remaining_attempts: 3, user_id: user.uuid, flow_path: 'standard', front_image_fingerprint: an_instance_of(String), back_image_fingerprint: an_instance_of(String) }, 'IdV: doc auth image upload vendor pii validation' => { success: true, errors: {}, user_id: user.uuid, attempts: 1, remaining_attempts: 3, flow_path: 'standard', attention_with_barcode: false, front_image_fingerprint: an_instance_of(String), back_image_fingerprint: an_instance_of(String) }, - 'IdV: doc auth document_capture submitted' => { success: true, errors: {}, flow_path: 'standard', step: 'document_capture', :acuant_sdk_upgrade_ab_test_bucket=>:default, :getting_started_ab_test_bucket=>:welcome, analytics_id: 'Doc Auth', irs_reproofing: false }, - 'IdV: doc auth ssn visited' => { flow_path: 'standard', step: 'ssn', :acuant_sdk_upgrade_ab_test_bucket=>:default, :getting_started_ab_test_bucket=>:welcome, analytics_id: 'Doc Auth', irs_reproofing: false }, - 'IdV: doc auth ssn submitted' => { success: true, errors: {}, flow_path: 'standard', step: 'ssn', :acuant_sdk_upgrade_ab_test_bucket=>:default, :getting_started_ab_test_bucket=>:welcome, analytics_id: 'Doc Auth', irs_reproofing: false }, - 'IdV: doc auth verify visited' => { flow_path: 'standard', step: 'verify', :acuant_sdk_upgrade_ab_test_bucket=>:default, :getting_started_ab_test_bucket=>:welcome, analytics_id: 'Doc Auth', irs_reproofing: false }, - 'IdV: doc auth verify submitted' => { flow_path: 'standard', step: 'verify', :acuant_sdk_upgrade_ab_test_bucket=>:default, :getting_started_ab_test_bucket=>:welcome, analytics_id: 'Doc Auth', irs_reproofing: false }, + 'IdV: doc auth document_capture submitted' => { success: true, errors: {}, flow_path: 'standard', step: 'document_capture', acuant_sdk_upgrade_ab_test_bucket: :default, getting_started_ab_test_bucket: :welcome, analytics_id: 'Doc Auth', irs_reproofing: false }, + 'IdV: doc auth ssn visited' => { flow_path: 'standard', step: 'ssn', acuant_sdk_upgrade_ab_test_bucket: :default, getting_started_ab_test_bucket: :welcome, analytics_id: 'Doc Auth', irs_reproofing: false }, + 'IdV: doc auth ssn submitted' => { success: true, errors: {}, flow_path: 'standard', step: 'ssn', acuant_sdk_upgrade_ab_test_bucket: :default, getting_started_ab_test_bucket: :welcome, analytics_id: 'Doc Auth', irs_reproofing: false }, + 'IdV: doc auth verify visited' => { flow_path: 'standard', step: 'verify', acuant_sdk_upgrade_ab_test_bucket: :default, getting_started_ab_test_bucket: :welcome, analytics_id: 'Doc Auth', irs_reproofing: false }, + 'IdV: doc auth verify submitted' => { flow_path: 'standard', step: 'verify', acuant_sdk_upgrade_ab_test_bucket: :default, getting_started_ab_test_bucket: :welcome, analytics_id: 'Doc Auth', irs_reproofing: false }, 'IdV: doc auth verify proofing results' => { success: true, errors: {}, address_edited: false, address_line2_present: false, ssn_is_unique: true, proofing_results: { exception: nil, timed_out: false, threatmetrix_review_status: 'pass', context: { device_profiling_adjudication_reason: 'device_profiling_result_pass', double_address_verification: false, resolution_adjudication_reason: 'pass_resolution_and_state_id', should_proof_state_id: true, stages: { resolution: { success: true, errors: {}, exception: nil, timed_out: false, transaction_id: 'resolution-mock-transaction-id-123', reference: 'aaa-bbb-ccc', can_pass_with_additional_verification: false, attributes_requiring_additional_verification: [], vendor_name: 'ResolutionMock', vendor_workflow: nil }, residential_address: { errors: {}, exception: nil, reference: '', success: true, timed_out: false, transaction_id: '', vendor_name: 'ResidentialAddressNotRequired' }, state_id: { success: true, errors: {}, exception: nil, mva_exception: nil, timed_out: false, transaction_id: 'state-id-mock-transaction-id-456', vendor_name: 'StateIdMock', verified_attributes: [], state: 'MT', state_id_jurisdiction: 'ND', state_id_number: '#############' }, threatmetrix: threatmetrix_response } } } }, 'IdV: phone of record visited' => { proofing_components: { document_check: 'mock', document_type: 'state_id', source_check: 'aamva', resolution_check: 'lexis_nexis', threatmetrix: threatmetrix, threatmetrix_review_status: 'pass' } }, 'IdV: phone confirmation form' => { success: true, errors: {}, phone_type: :mobile, types: [:fixed_or_mobile], carrier: 'Test Mobile Carrier', country_code: 'US', area_code: '202', proofing_components: { document_check: 'mock', document_type: 'state_id', source_check: 'aamva', resolution_check: 'lexis_nexis', threatmetrix: threatmetrix, threatmetrix_review_status: 'pass' }, otp_delivery_preference: 'sms' }, @@ -72,18 +72,18 @@ 'IdV: doc auth welcome submitted' => { step: 'welcome', analytics_id: 'Doc Auth', irs_reproofing: false }, 'IdV: doc auth agreement visited' => { step: 'agreement', analytics_id: 'Doc Auth', irs_reproofing: false }, 'IdV: doc auth agreement submitted' => { success: true, errors: {}, step: 'agreement', analytics_id: 'Doc Auth', irs_reproofing: false }, - 'IdV: doc auth hybrid handoff visited' => { step: 'hybrid_handoff', :acuant_sdk_upgrade_ab_test_bucket=>:default, :getting_started_ab_test_bucket=>:welcome, analytics_id: 'Doc Auth', irs_reproofing: false }, - 'IdV: doc auth hybrid handoff submitted' => { success: true, errors: {}, destination: :document_capture, flow_path: 'standard', step: 'hybrid_handoff', :acuant_sdk_upgrade_ab_test_bucket=>:default, :getting_started_ab_test_bucket=>:welcome, analytics_id: 'Doc Auth', irs_reproofing: false, skip_upload_step: false }, - 'IdV: doc auth document_capture visited' => { flow_path: 'standard', step: 'document_capture', :acuant_sdk_upgrade_ab_test_bucket=>:default, :getting_started_ab_test_bucket=>:welcome, analytics_id: 'Doc Auth', irs_reproofing: false }, + 'IdV: doc auth hybrid handoff visited' => { step: 'hybrid_handoff', acuant_sdk_upgrade_ab_test_bucket: :default, getting_started_ab_test_bucket: :welcome, analytics_id: 'Doc Auth', irs_reproofing: false }, + 'IdV: doc auth hybrid handoff submitted' => { success: true, errors: {}, destination: :document_capture, flow_path: 'standard', step: 'hybrid_handoff', acuant_sdk_upgrade_ab_test_bucket: :default, getting_started_ab_test_bucket: :welcome, analytics_id: 'Doc Auth', irs_reproofing: false, skip_upload_step: false }, + 'IdV: doc auth document_capture visited' => { flow_path: 'standard', step: 'document_capture', acuant_sdk_upgrade_ab_test_bucket: :default, getting_started_ab_test_bucket: :welcome, analytics_id: 'Doc Auth', irs_reproofing: false }, 'Frontend: IdV: front image added' => { 'width' => 284, 'height' => 38, 'mimeType' => 'image/png', 'source' => 'upload', 'size' => 3694, 'attempt' => 1, 'flow_path' => 'standard', 'acuant_sdk_upgrade_a_b_testing_enabled' => 'false', 'use_alternate_sdk' => anything, 'acuant_version' => anything }, 'Frontend: IdV: back image added' => { 'width' => 284, 'height' => 38, 'mimeType' => 'image/png', 'source' => 'upload', 'size' => 3694, 'attempt' => 1, 'flow_path' => 'standard', 'acuant_sdk_upgrade_a_b_testing_enabled' => 'false', 'use_alternate_sdk' => anything, 'acuant_version' => anything }, 'IdV: doc auth image upload form submitted' => { success: true, errors: {}, attempts: 1, remaining_attempts: 3, user_id: user.uuid, flow_path: 'standard', front_image_fingerprint: an_instance_of(String), back_image_fingerprint: an_instance_of(String) }, 'IdV: doc auth image upload vendor pii validation' => { success: true, errors: {}, user_id: user.uuid, attempts: 1, remaining_attempts: 3, flow_path: 'standard', attention_with_barcode: false, front_image_fingerprint: an_instance_of(String), back_image_fingerprint: an_instance_of(String) }, - 'IdV: doc auth document_capture submitted' => { success: true, errors: {}, flow_path: 'standard', step: 'document_capture', :acuant_sdk_upgrade_ab_test_bucket=>:default, :getting_started_ab_test_bucket=>:welcome, analytics_id: 'Doc Auth', irs_reproofing: false }, - 'IdV: doc auth ssn visited' => { flow_path: 'standard', step: 'ssn', :acuant_sdk_upgrade_ab_test_bucket=>:default, :getting_started_ab_test_bucket=>:welcome, analytics_id: 'Doc Auth', irs_reproofing: false }, - 'IdV: doc auth ssn submitted' => { success: true, errors: {}, flow_path: 'standard', step: 'ssn', :acuant_sdk_upgrade_ab_test_bucket=>:default, :getting_started_ab_test_bucket=>:welcome, analytics_id: 'Doc Auth', irs_reproofing: false }, - 'IdV: doc auth verify visited' => { flow_path: 'standard', step: 'verify', :acuant_sdk_upgrade_ab_test_bucket=>:default, :getting_started_ab_test_bucket=>:welcome, analytics_id: 'Doc Auth', irs_reproofing: false }, - 'IdV: doc auth verify submitted' => { flow_path: 'standard', step: 'verify', :acuant_sdk_upgrade_ab_test_bucket=>:default, :getting_started_ab_test_bucket=>:welcome, analytics_id: 'Doc Auth', irs_reproofing: false }, + 'IdV: doc auth document_capture submitted' => { success: true, errors: {}, flow_path: 'standard', step: 'document_capture', acuant_sdk_upgrade_ab_test_bucket: :default, getting_started_ab_test_bucket: :welcome, analytics_id: 'Doc Auth', irs_reproofing: false }, + 'IdV: doc auth ssn visited' => { flow_path: 'standard', step: 'ssn', acuant_sdk_upgrade_ab_test_bucket: :default, getting_started_ab_test_bucket: :welcome, analytics_id: 'Doc Auth', irs_reproofing: false }, + 'IdV: doc auth ssn submitted' => { success: true, errors: {}, flow_path: 'standard', step: 'ssn', acuant_sdk_upgrade_ab_test_bucket: :default, getting_started_ab_test_bucket: :welcome, analytics_id: 'Doc Auth', irs_reproofing: false }, + 'IdV: doc auth verify visited' => { flow_path: 'standard', step: 'verify', acuant_sdk_upgrade_ab_test_bucket: :default, getting_started_ab_test_bucket: :welcome, analytics_id: 'Doc Auth', irs_reproofing: false }, + 'IdV: doc auth verify submitted' => { flow_path: 'standard', step: 'verify', acuant_sdk_upgrade_ab_test_bucket: :default, getting_started_ab_test_bucket: :welcome, analytics_id: 'Doc Auth', irs_reproofing: false }, 'IdV: doc auth verify proofing results' => { success: true, errors: {}, address_edited: false, address_line2_present: false, ssn_is_unique: true, proofing_results: { exception: nil, timed_out: false, threatmetrix_review_status: 'pass', context: { device_profiling_adjudication_reason: 'device_profiling_result_pass', resolution_adjudication_reason: 'pass_resolution_and_state_id', double_address_verification: false, should_proof_state_id: true, stages: { resolution: { success: true, errors: {}, exception: nil, timed_out: false, transaction_id: 'resolution-mock-transaction-id-123', reference: 'aaa-bbb-ccc', can_pass_with_additional_verification: false, attributes_requiring_additional_verification: [], vendor_name: 'ResolutionMock', vendor_workflow: nil }, residential_address: { errors: {}, exception: nil, reference: '', success: true, timed_out: false, transaction_id: '', vendor_name: 'ResidentialAddressNotRequired' }, state_id: { success: true, errors: {}, exception: nil, mva_exception: nil, timed_out: false, transaction_id: 'state-id-mock-transaction-id-456', vendor_name: 'StateIdMock', verified_attributes: [], state: 'MT', state_id_jurisdiction: 'ND', state_id_number: '#############' }, threatmetrix: threatmetrix_response } } } }, 'IdV: phone of record visited' => { proofing_components: { document_check: 'mock', document_type: 'state_id', source_check: 'aamva', resolution_check: 'lexis_nexis', threatmetrix: threatmetrix, threatmetrix_review_status: 'pass' } }, 'IdV: USPS address letter requested' => { resend: false, proofing_components: { document_check: 'mock', document_type: 'state_id', source_check: 'aamva', resolution_check: 'lexis_nexis', threatmetrix: threatmetrix, threatmetrix_review_status: 'pass' } }, @@ -101,9 +101,9 @@ 'IdV: doc auth welcome submitted' => { step: 'welcome', analytics_id: 'Doc Auth', irs_reproofing: false }, 'IdV: doc auth agreement visited' => { step: 'agreement', analytics_id: 'Doc Auth', irs_reproofing: false }, 'IdV: doc auth agreement submitted' => { success: true, errors: {}, step: 'agreement', analytics_id: 'Doc Auth', irs_reproofing: false }, - 'IdV: doc auth hybrid handoff visited' => { step: 'hybrid_handoff', :acuant_sdk_upgrade_ab_test_bucket=>:default, :getting_started_ab_test_bucket=>:welcome, analytics_id: 'Doc Auth', irs_reproofing: false }, - 'IdV: doc auth hybrid handoff submitted' => { success: true, errors: {}, destination: :document_capture, flow_path: 'standard', step: 'hybrid_handoff', :acuant_sdk_upgrade_ab_test_bucket=>:default, :getting_started_ab_test_bucket=>:welcome, analytics_id: 'Doc Auth', irs_reproofing: false, skip_upload_step: false }, - 'IdV: doc auth document_capture visited' => { flow_path: 'standard', step: 'document_capture', :acuant_sdk_upgrade_ab_test_bucket=>:default, :getting_started_ab_test_bucket=>:welcome, analytics_id: 'Doc Auth', irs_reproofing: false }, + 'IdV: doc auth hybrid handoff visited' => { step: 'hybrid_handoff', acuant_sdk_upgrade_ab_test_bucket: :default, getting_started_ab_test_bucket: :welcome, analytics_id: 'Doc Auth', irs_reproofing: false }, + 'IdV: doc auth hybrid handoff submitted' => { success: true, errors: {}, destination: :document_capture, flow_path: 'standard', step: 'hybrid_handoff', acuant_sdk_upgrade_ab_test_bucket: :default, getting_started_ab_test_bucket: :welcome, analytics_id: 'Doc Auth', irs_reproofing: false, skip_upload_step: false }, + 'IdV: doc auth document_capture visited' => { flow_path: 'standard', step: 'document_capture', acuant_sdk_upgrade_ab_test_bucket: :default, getting_started_ab_test_bucket: :welcome, analytics_id: 'Doc Auth', irs_reproofing: false }, 'Frontend: IdV: front image added' => { 'width' => 284, 'height' => 38, 'mimeType' => 'image/png', 'source' => 'upload', 'size' => 3694, 'attempt' => 1, 'flow_path' => 'standard', 'acuant_sdk_upgrade_a_b_testing_enabled' => 'false', 'use_alternate_sdk' => anything, 'acuant_version' => anything }, 'Frontend: IdV: back image added' => { 'width' => 284, 'height' => 38, 'mimeType' => 'image/png', 'source' => 'upload', 'size' => 3694, 'attempt' => 1, 'flow_path' => 'standard', 'acuant_sdk_upgrade_a_b_testing_enabled' => 'false', 'use_alternate_sdk' => anything, 'acuant_version' => anything }, 'IdV: doc auth image upload form submitted' => { success: true, errors: {}, attempts: 1, remaining_attempts: 3, user_id: user.uuid, flow_path: 'standard', front_image_fingerprint: an_instance_of(String), back_image_fingerprint: an_instance_of(String) }, From 1794b96dadacf8796e0772ff2e00f384c152b9ad Mon Sep 17 00:00:00 2001 From: Sonia Connolly Date: Thu, 20 Jul 2023 14:12:55 -0700 Subject: [PATCH 12/20] Revert "Collect ab test analytics methods in AbTestAnalyticsConcern rather than including other concerns" well that didn't work out! This reverts commit 18a5cd39d558f7ba1574ad3f243e4d5bc52fe21d. --- .../concerns/idv/ab_test_analytics_concern.rb | 21 +++---------------- .../concerns/idv/acuant_concern.rb | 9 ++++++++ .../idv/getting_started_ab_test_concern.rb | 9 ++++++++ 3 files changed, 21 insertions(+), 18 deletions(-) diff --git a/app/controllers/concerns/idv/ab_test_analytics_concern.rb b/app/controllers/concerns/idv/ab_test_analytics_concern.rb index aca8bc4559b..7391b45a02d 100644 --- a/app/controllers/concerns/idv/ab_test_analytics_concern.rb +++ b/app/controllers/concerns/idv/ab_test_analytics_concern.rb @@ -1,26 +1,11 @@ module Idv module AbTestAnalyticsConcern + include AcuantConcern + include Idv::GettingStartedAbTestConcern + def ab_test_analytics_args acuant_sdk_ab_test_analytics_args. merge(getting_started_ab_test_analytics_args) end - - def acuant_sdk_ab_test_analytics_args - return {} if document_capture_session_uuid.blank? - - { - acuant_sdk_upgrade_ab_test_bucket: - AbTests::ACUANT_SDK.bucket(document_capture_session_uuid), - } - end - - def getting_started_ab_test_analytics_args - return {} if current_user.blank? - - { - getting_started_ab_test_bucket: - getting_started_ab_test_bucket, - } - end end end diff --git a/app/controllers/concerns/idv/acuant_concern.rb b/app/controllers/concerns/idv/acuant_concern.rb index cb3113db692..68dd8920431 100644 --- a/app/controllers/concerns/idv/acuant_concern.rb +++ b/app/controllers/concerns/idv/acuant_concern.rb @@ -1,5 +1,14 @@ module Idv module AcuantConcern + def acuant_sdk_ab_test_analytics_args + return {} if document_capture_session_uuid.blank? + + { + acuant_sdk_upgrade_ab_test_bucket: + AbTests::ACUANT_SDK.bucket(document_capture_session_uuid), + } + end + def acuant_sdk_upgrade_a_b_testing_variables bucket = AbTests::ACUANT_SDK.bucket(document_capture_session_uuid) testing_enabled = IdentityConfig.store.idv_acuant_sdk_upgrade_a_b_testing_enabled diff --git a/app/controllers/concerns/idv/getting_started_ab_test_concern.rb b/app/controllers/concerns/idv/getting_started_ab_test_concern.rb index 9ed21b194cb..5a9b3ce84f1 100644 --- a/app/controllers/concerns/idv/getting_started_ab_test_concern.rb +++ b/app/controllers/concerns/idv/getting_started_ab_test_concern.rb @@ -9,5 +9,14 @@ def maybe_redirect_for_getting_started_ab_test redirect_to idv_getting_started_url end + + def getting_started_ab_test_analytics_args + return {} if current_user.blank? + + { + getting_started_ab_test_bucket: + getting_started_ab_test_bucket, + } + end end end From e83e9613e1fda308569e15a5a1358b5a71cfd9ab Mon Sep 17 00:00:00 2001 From: Sonia Connolly Date: Thu, 20 Jul 2023 14:23:05 -0700 Subject: [PATCH 13/20] Rename ab_test_analytics_args to ab_test_analytics_buckets --- app/controllers/concerns/idv/ab_test_analytics_concern.rb | 2 +- app/controllers/idv/document_capture_controller.rb | 2 +- app/controllers/idv/hybrid_handoff_controller.rb | 2 +- .../idv/hybrid_mobile/capture_complete_controller.rb | 2 +- .../idv/hybrid_mobile/document_capture_controller.rb | 2 +- app/controllers/idv/in_person/ssn_controller.rb | 2 +- app/controllers/idv/in_person/verify_info_controller.rb | 2 +- app/controllers/idv/link_sent_controller.rb | 2 +- app/controllers/idv/ssn_controller.rb | 2 +- app/controllers/idv/verify_info_controller.rb | 2 +- .../concerns/idv/ab_test_analytics_concern_spec.rb | 6 +++--- spec/controllers/idv/document_capture_controller_spec.rb | 2 +- spec/controllers/idv/hybrid_handoff_controller_spec.rb | 2 +- .../idv/hybrid_mobile/capture_complete_controller_spec.rb | 2 +- .../idv/hybrid_mobile/document_capture_controller_spec.rb | 2 +- spec/controllers/idv/in_person/ssn_controller_spec.rb | 2 +- .../idv/in_person/verify_info_controller_spec.rb | 2 +- spec/controllers/idv/link_sent_controller_spec.rb | 2 +- spec/controllers/idv/ssn_controller_spec.rb | 2 +- spec/controllers/idv/verify_info_controller_spec.rb | 2 +- 20 files changed, 22 insertions(+), 22 deletions(-) diff --git a/app/controllers/concerns/idv/ab_test_analytics_concern.rb b/app/controllers/concerns/idv/ab_test_analytics_concern.rb index 7391b45a02d..cc45d275202 100644 --- a/app/controllers/concerns/idv/ab_test_analytics_concern.rb +++ b/app/controllers/concerns/idv/ab_test_analytics_concern.rb @@ -3,7 +3,7 @@ module AbTestAnalyticsConcern include AcuantConcern include Idv::GettingStartedAbTestConcern - def ab_test_analytics_args + def ab_test_analytics_buckets acuant_sdk_ab_test_analytics_args. merge(getting_started_ab_test_analytics_args) end diff --git a/app/controllers/idv/document_capture_controller.rb b/app/controllers/idv/document_capture_controller.rb index 94519526b4d..61489f58413 100644 --- a/app/controllers/idv/document_capture_controller.rb +++ b/app/controllers/idv/document_capture_controller.rb @@ -75,7 +75,7 @@ def analytics_arguments analytics_id: 'Doc Auth', irs_reproofing: irs_reproofing?, redo_document_capture: flow_session[:redo_document_capture], - }.compact.merge(ab_test_analytics_args) + }.compact.merge(ab_test_analytics_buckets) end def handle_stored_result diff --git a/app/controllers/idv/hybrid_handoff_controller.rb b/app/controllers/idv/hybrid_handoff_controller.rb index c61460bf48b..16f64a09205 100644 --- a/app/controllers/idv/hybrid_handoff_controller.rb +++ b/app/controllers/idv/hybrid_handoff_controller.rb @@ -156,7 +156,7 @@ def analytics_arguments analytics_id: 'Doc Auth', irs_reproofing: irs_reproofing?, redo_document_capture: params[:redo] ? true : nil, - }.compact.merge(ab_test_analytics_args) + }.compact.merge(ab_test_analytics_buckets) end def form_response(destination:) diff --git a/app/controllers/idv/hybrid_mobile/capture_complete_controller.rb b/app/controllers/idv/hybrid_mobile/capture_complete_controller.rb index 34fa1d6d05a..13b2e88acf1 100644 --- a/app/controllers/idv/hybrid_mobile/capture_complete_controller.rb +++ b/app/controllers/idv/hybrid_mobile/capture_complete_controller.rb @@ -22,7 +22,7 @@ def analytics_arguments step: 'capture_complete', analytics_id: 'Doc Auth', irs_reproofing: irs_reproofing?, - }.merge(ab_test_analytics_args) + }.merge(ab_test_analytics_buckets) end end end diff --git a/app/controllers/idv/hybrid_mobile/document_capture_controller.rb b/app/controllers/idv/hybrid_mobile/document_capture_controller.rb index f69db4ea344..2241569439d 100644 --- a/app/controllers/idv/hybrid_mobile/document_capture_controller.rb +++ b/app/controllers/idv/hybrid_mobile/document_capture_controller.rb @@ -56,7 +56,7 @@ def analytics_arguments step: 'document_capture', analytics_id: 'Doc Auth', irs_reproofing: irs_reproofing?, - }.merge(ab_test_analytics_args) + }.merge(ab_test_analytics_buckets) end def handle_stored_result diff --git a/app/controllers/idv/in_person/ssn_controller.rb b/app/controllers/idv/in_person/ssn_controller.rb index f3907e8be1c..7fb74026d54 100644 --- a/app/controllers/idv/in_person/ssn_controller.rb +++ b/app/controllers/idv/in_person/ssn_controller.rb @@ -83,7 +83,7 @@ def analytics_arguments step: 'ssn', analytics_id: 'In Person Proofing', irs_reproofing: irs_reproofing?, - }.merge(ab_test_analytics_args) + }.merge(ab_test_analytics_buckets) end def updating_ssn? diff --git a/app/controllers/idv/in_person/verify_info_controller.rb b/app/controllers/idv/in_person/verify_info_controller.rb index b6b0f21139b..54c9d7a3910 100644 --- a/app/controllers/idv/in_person/verify_info_controller.rb +++ b/app/controllers/idv/in_person/verify_info_controller.rb @@ -73,7 +73,7 @@ def analytics_arguments step: 'verify', analytics_id: 'In Person Proofing', irs_reproofing: irs_reproofing?, - }.merge(ab_test_analytics_args). + }.merge(ab_test_analytics_buckets). merge(**extra_analytics_properties) end diff --git a/app/controllers/idv/link_sent_controller.rb b/app/controllers/idv/link_sent_controller.rb index e4d4395afb8..3c90687cdad 100644 --- a/app/controllers/idv/link_sent_controller.rb +++ b/app/controllers/idv/link_sent_controller.rb @@ -62,7 +62,7 @@ def analytics_arguments analytics_id: 'Doc Auth', flow_path: 'hybrid', irs_reproofing: irs_reproofing?, - }.merge(ab_test_analytics_args) + }.merge(ab_test_analytics_buckets) end def handle_document_verification_success(get_results_response) diff --git a/app/controllers/idv/ssn_controller.rb b/app/controllers/idv/ssn_controller.rb index fd4d4864da3..942c11b05bf 100644 --- a/app/controllers/idv/ssn_controller.rb +++ b/app/controllers/idv/ssn_controller.rb @@ -89,7 +89,7 @@ def analytics_arguments step: 'ssn', analytics_id: 'Doc Auth', irs_reproofing: irs_reproofing?, - }.merge(ab_test_analytics_args) + }.merge(ab_test_analytics_buckets) end def updating_ssn? diff --git a/app/controllers/idv/verify_info_controller.rb b/app/controllers/idv/verify_info_controller.rb index 1ad9611573c..9918d141c09 100644 --- a/app/controllers/idv/verify_info_controller.rb +++ b/app/controllers/idv/verify_info_controller.rb @@ -51,7 +51,7 @@ def analytics_arguments step: 'verify', analytics_id: 'Doc Auth', irs_reproofing: irs_reproofing?, - }.merge(ab_test_analytics_args) + }.merge(ab_test_analytics_buckets) end # copied from verify_step diff --git a/spec/controllers/concerns/idv/ab_test_analytics_concern_spec.rb b/spec/controllers/concerns/idv/ab_test_analytics_concern_spec.rb index c5fa801246e..7dbc00f97c1 100644 --- a/spec/controllers/concerns/idv/ab_test_analytics_concern_spec.rb +++ b/spec/controllers/concerns/idv/ab_test_analytics_concern_spec.rb @@ -7,7 +7,7 @@ class StepController < ApplicationController end end - describe '#ab_test_analytics_args' do + describe '#ab_test_analytics_buckets' do controller Idv::StepController do end @@ -15,14 +15,14 @@ class StepController < ApplicationController acuant_sdk_args = { as_bucket: :as_value } expect(subject).to receive(:acuant_sdk_ab_test_analytics_args). and_return(acuant_sdk_args) - expect(controller.ab_test_analytics_args).to include(acuant_sdk_args) + expect(controller.ab_test_analytics_buckets).to include(acuant_sdk_args) end it 'includes getting_started_ab_test_analytics_args' do getting_started_args = { gs_bucket: :gs_value } expect(subject).to receive(:acuant_sdk_ab_test_analytics_args). and_return(getting_started_args) - expect(controller.ab_test_analytics_args).to include(getting_started_args) + expect(controller.ab_test_analytics_buckets).to include(getting_started_args) end end end diff --git a/spec/controllers/idv/document_capture_controller_spec.rb b/spec/controllers/idv/document_capture_controller_spec.rb index ca77dbf558a..e5beb10e1f5 100644 --- a/spec/controllers/idv/document_capture_controller_spec.rb +++ b/spec/controllers/idv/document_capture_controller_spec.rb @@ -20,7 +20,7 @@ subject.idv_session.flow_path = 'standard' subject.user_session['idv/doc_auth'] = flow_session - allow(subject).to receive(:ab_test_analytics_args).and_return(ab_test_args) + allow(subject).to receive(:ab_test_analytics_buckets).and_return(ab_test_args) end describe 'before_actions' do diff --git a/spec/controllers/idv/hybrid_handoff_controller_spec.rb b/spec/controllers/idv/hybrid_handoff_controller_spec.rb index b9500de5fb9..448c574413c 100644 --- a/spec/controllers/idv/hybrid_handoff_controller_spec.rb +++ b/spec/controllers/idv/hybrid_handoff_controller_spec.rb @@ -15,7 +15,7 @@ stub_attempts_tracker subject.user_session['idv/doc_auth'] = {} subject.idv_session.idv_consent_given = true - allow(subject).to receive(:ab_test_analytics_args).and_return(ab_test_args) + allow(subject).to receive(:ab_test_analytics_buckets).and_return(ab_test_args) end describe 'before_actions' do diff --git a/spec/controllers/idv/hybrid_mobile/capture_complete_controller_spec.rb b/spec/controllers/idv/hybrid_mobile/capture_complete_controller_spec.rb index 7a70fba615d..f5d87d9fdd9 100644 --- a/spec/controllers/idv/hybrid_mobile/capture_complete_controller_spec.rb +++ b/spec/controllers/idv/hybrid_mobile/capture_complete_controller_spec.rb @@ -33,7 +33,7 @@ allow(@analytics).to receive(:track_event) allow(subject).to receive(:confirm_document_capture_session_complete). and_return(true) - allow(subject).to receive(:ab_test_analytics_args).and_return(ab_test_args) + allow(subject).to receive(:ab_test_analytics_buckets).and_return(ab_test_args) end describe 'before_actions' do diff --git a/spec/controllers/idv/hybrid_mobile/document_capture_controller_spec.rb b/spec/controllers/idv/hybrid_mobile/document_capture_controller_spec.rb index 50daf410812..fcacb00a32a 100644 --- a/spec/controllers/idv/hybrid_mobile/document_capture_controller_spec.rb +++ b/spec/controllers/idv/hybrid_mobile/document_capture_controller_spec.rb @@ -27,7 +27,7 @@ session[:doc_capture_user_id] = user&.id session[:document_capture_session_uuid] = document_capture_session_uuid - allow(subject).to receive(:ab_test_analytics_args).and_return(ab_test_args) + allow(subject).to receive(:ab_test_analytics_buckets).and_return(ab_test_args) end describe 'before_actions' do diff --git a/spec/controllers/idv/in_person/ssn_controller_spec.rb b/spec/controllers/idv/in_person/ssn_controller_spec.rb index d8c5067e72e..7ef46e95e25 100644 --- a/spec/controllers/idv/in_person/ssn_controller_spec.rb +++ b/spec/controllers/idv/in_person/ssn_controller_spec.rb @@ -24,7 +24,7 @@ stub_analytics stub_attempts_tracker allow(@analytics).to receive(:track_event) - allow(subject).to receive(:ab_test_analytics_args).and_return(ab_test_args) + allow(subject).to receive(:ab_test_analytics_buckets).and_return(ab_test_args) end describe 'before_actions' do diff --git a/spec/controllers/idv/in_person/verify_info_controller_spec.rb b/spec/controllers/idv/in_person/verify_info_controller_spec.rb index 66eb64e6d4b..fb2ae1d1779 100644 --- a/spec/controllers/idv/in_person/verify_info_controller_spec.rb +++ b/spec/controllers/idv/in_person/verify_info_controller_spec.rb @@ -20,7 +20,7 @@ before do allow(subject).to receive(:flow_session).and_return(flow_session) stub_sign_in(user) - allow(subject).to receive(:ab_test_analytics_args).and_return(ab_test_args) + allow(subject).to receive(:ab_test_analytics_buckets).and_return(ab_test_args) end describe 'before_actions' do diff --git a/spec/controllers/idv/link_sent_controller_spec.rb b/spec/controllers/idv/link_sent_controller_spec.rb index bdcd64819dd..fd570d7b43a 100644 --- a/spec/controllers/idv/link_sent_controller_spec.rb +++ b/spec/controllers/idv/link_sent_controller_spec.rb @@ -21,7 +21,7 @@ stub_analytics stub_attempts_tracker allow(@analytics).to receive(:track_event) - allow(subject).to receive(:ab_test_analytics_args).and_return(ab_test_args) + allow(subject).to receive(:ab_test_analytics_buckets).and_return(ab_test_args) end describe 'before_actions' do diff --git a/spec/controllers/idv/ssn_controller_spec.rb b/spec/controllers/idv/ssn_controller_spec.rb index 833eb9abbd8..3ee13eee5af 100644 --- a/spec/controllers/idv/ssn_controller_spec.rb +++ b/spec/controllers/idv/ssn_controller_spec.rb @@ -24,7 +24,7 @@ stub_analytics stub_attempts_tracker allow(@analytics).to receive(:track_event) - allow(subject).to receive(:ab_test_analytics_args).and_return(ab_test_args) + allow(subject).to receive(:ab_test_analytics_buckets).and_return(ab_test_args) end describe 'before_actions' do diff --git a/spec/controllers/idv/verify_info_controller_spec.rb b/spec/controllers/idv/verify_info_controller_spec.rb index 3287af35c1b..65d72cd5d2a 100644 --- a/spec/controllers/idv/verify_info_controller_spec.rb +++ b/spec/controllers/idv/verify_info_controller_spec.rb @@ -30,7 +30,7 @@ stub_idv_steps_before_verify_step(user) subject.idv_session.flow_path = 'standard' subject.user_session['idv/doc_auth'] = flow_session - allow(subject).to receive(:ab_test_analytics_args).and_return(ab_test_args) + allow(subject).to receive(:ab_test_analytics_buckets).and_return(ab_test_args) end describe 'before_actions' do From 545fd5780d6e367d3b21b132929016099dc209ee Mon Sep 17 00:00:00 2001 From: Sonia Connolly Date: Thu, 20 Jul 2023 14:58:43 -0700 Subject: [PATCH 14/20] Get uuid from document_capture_user in hybrid flow Rename getting_started_ab_test_analytics_args to getting_started_ab_test_analytics_bucket Add navigation to Welcome page in hybrid_mobile_spec to ensure that it doesn't 500 in A/B test before_action Co-authored-by: Jonathan Hooper Co-authored-by: Zach Margolis --- .../concerns/idv/ab_test_analytics_concern.rb | 2 +- .../idv/getting_started_ab_test_concern.rb | 13 +++++++++---- .../idv/ab_test_analytics_concern_spec.rb | 19 +++++++++++++------ .../idv/hybrid_mobile/hybrid_mobile_spec.rb | 6 ++++++ 4 files changed, 29 insertions(+), 11 deletions(-) diff --git a/app/controllers/concerns/idv/ab_test_analytics_concern.rb b/app/controllers/concerns/idv/ab_test_analytics_concern.rb index cc45d275202..874523a3503 100644 --- a/app/controllers/concerns/idv/ab_test_analytics_concern.rb +++ b/app/controllers/concerns/idv/ab_test_analytics_concern.rb @@ -5,7 +5,7 @@ module AbTestAnalyticsConcern def ab_test_analytics_buckets acuant_sdk_ab_test_analytics_args. - merge(getting_started_ab_test_analytics_args) + merge(getting_started_ab_test_analytics_bucket) end end end diff --git a/app/controllers/concerns/idv/getting_started_ab_test_concern.rb b/app/controllers/concerns/idv/getting_started_ab_test_concern.rb index 5a9b3ce84f1..a280182958d 100644 --- a/app/controllers/concerns/idv/getting_started_ab_test_concern.rb +++ b/app/controllers/concerns/idv/getting_started_ab_test_concern.rb @@ -1,7 +1,14 @@ module Idv module GettingStartedAbTestConcern def getting_started_ab_test_bucket - AbTests::IDV_GETTING_STARTED.bucket(current_user&.uuid) + uuid = + if defined?(document_capture_user) # hybrid flow + document_capture_user.uuid + else + current_user.uuid + end + + AbTests::IDV_GETTING_STARTED.bucket(uuid) end def maybe_redirect_for_getting_started_ab_test @@ -10,9 +17,7 @@ def maybe_redirect_for_getting_started_ab_test redirect_to idv_getting_started_url end - def getting_started_ab_test_analytics_args - return {} if current_user.blank? - + def getting_started_ab_test_analytics_bucket { getting_started_ab_test_bucket: getting_started_ab_test_bucket, diff --git a/spec/controllers/concerns/idv/ab_test_analytics_concern_spec.rb b/spec/controllers/concerns/idv/ab_test_analytics_concern_spec.rb index 7dbc00f97c1..5181f0a8470 100644 --- a/spec/controllers/concerns/idv/ab_test_analytics_concern_spec.rb +++ b/spec/controllers/concerns/idv/ab_test_analytics_concern_spec.rb @@ -7,21 +7,28 @@ class StepController < ApplicationController end end + let(:user) { create(:user) } + describe '#ab_test_analytics_buckets' do controller Idv::StepController do end - it 'includes acuant_sdk_ab_test_analytics_args' do - acuant_sdk_args = { as_bucket: :as_value } + let(:acuant_sdk_args) { { as_bucket: :as_value } } + let(:getting_started_args) { { gs_bucket: :gs_value } } + + before do + allow(subject).to receive(:current_user).and_return(user) expect(subject).to receive(:acuant_sdk_ab_test_analytics_args). and_return(acuant_sdk_args) + expect(subject).to receive(:getting_started_ab_test_analytics_bucket). + and_return(getting_started_args) + end + + it 'includes acuant_sdk_ab_test_analytics_args' do expect(controller.ab_test_analytics_buckets).to include(acuant_sdk_args) end - it 'includes getting_started_ab_test_analytics_args' do - getting_started_args = { gs_bucket: :gs_value } - expect(subject).to receive(:acuant_sdk_ab_test_analytics_args). - and_return(getting_started_args) + it 'includes getting_started_ab_test_analytics_bucket' do expect(controller.ab_test_analytics_buckets).to include(getting_started_args) end end diff --git a/spec/features/idv/hybrid_mobile/hybrid_mobile_spec.rb b/spec/features/idv/hybrid_mobile/hybrid_mobile_spec.rb index 2f8ad0ff54c..72d008befb8 100644 --- a/spec/features/idv/hybrid_mobile/hybrid_mobile_spec.rb +++ b/spec/features/idv/hybrid_mobile/hybrid_mobile_spec.rb @@ -45,6 +45,12 @@ expect(page).to have_current_path(root_url) visit idv_hybrid_mobile_document_capture_url + # Confirm that jumping to Welcome page does not cause errors + # This was added for the GettingStarted A/B Test + visit idv_welcome_url + expect(page).to have_current_path(root_url) + visit idv_hybrid_mobile_document_capture_url + attach_and_submit_images expect(page).to have_current_path(idv_hybrid_mobile_capture_complete_url) From 37ac56c3a114328141916a00405b9bc945e76587 Mon Sep 17 00:00:00 2001 From: Sonia Connolly Date: Thu, 20 Jul 2023 15:17:51 -0700 Subject: [PATCH 15/20] Add a/b test bucket info to analytics for GettingStarted, Welcome, Agreement For completeness for future A/B tests, and for possible ease of queries --- app/controllers/idv/agreement_controller.rb | 2 +- .../idv/getting_started_controller.rb | 2 +- app/controllers/idv/welcome_controller.rb | 2 +- .../getting_started_ab_test_concern_spec.rb | 2 +- .../idv/agreement_controller_spec.rb | 17 +++++++++---- .../idv/getting_started_controller_spec.rb | 17 +++++++++---- .../idv/welcome_controller_spec.rb | 17 +++++++++---- spec/features/idv/analytics_spec.rb | 24 +++++++++---------- 8 files changed, 55 insertions(+), 28 deletions(-) diff --git a/app/controllers/idv/agreement_controller.rb b/app/controllers/idv/agreement_controller.rb index afbd91ca684..5f0eb826325 100644 --- a/app/controllers/idv/agreement_controller.rb +++ b/app/controllers/idv/agreement_controller.rb @@ -42,7 +42,7 @@ def analytics_arguments step: 'agreement', analytics_id: 'Doc Auth', irs_reproofing: irs_reproofing?, - } + }.merge(ab_test_analytics_buckets) end def skip_to_capture diff --git a/app/controllers/idv/getting_started_controller.rb b/app/controllers/idv/getting_started_controller.rb index 8f27a4ddde2..ccaba1b1de8 100644 --- a/app/controllers/idv/getting_started_controller.rb +++ b/app/controllers/idv/getting_started_controller.rb @@ -48,7 +48,7 @@ def analytics_arguments step: 'getting_started', analytics_id: 'Doc Auth', irs_reproofing: irs_reproofing?, - } + }.merge(ab_test_analytics_buckets) end def create_document_capture_session diff --git a/app/controllers/idv/welcome_controller.rb b/app/controllers/idv/welcome_controller.rb index ba167adaa09..966a896fd2c 100644 --- a/app/controllers/idv/welcome_controller.rb +++ b/app/controllers/idv/welcome_controller.rb @@ -36,7 +36,7 @@ def analytics_arguments step: 'welcome', analytics_id: 'Doc Auth', irs_reproofing: irs_reproofing?, - } + }.merge(ab_test_analytics_buckets) end def create_document_capture_session diff --git a/spec/controllers/concerns/idv/getting_started_ab_test_concern_spec.rb b/spec/controllers/concerns/idv/getting_started_ab_test_concern_spec.rb index 74d0dc4fb75..199f8bff96c 100644 --- a/spec/controllers/concerns/idv/getting_started_ab_test_concern_spec.rb +++ b/spec/controllers/concerns/idv/getting_started_ab_test_concern_spec.rb @@ -37,7 +37,7 @@ def show user2 = create(:user, :fully_registered, email: 'new_email@example.com') allow(controller).to receive(:current_user).and_return(user2) end - it 'returns the bucket based on request id' do + it 'returns the bucket based on user id' do expect(controller.getting_started_ab_test_bucket).to eq(:welcome) end end diff --git a/spec/controllers/idv/agreement_controller_spec.rb b/spec/controllers/idv/agreement_controller_spec.rb index 5a87003d951..36b498a5ff2 100644 --- a/spec/controllers/idv/agreement_controller_spec.rb +++ b/spec/controllers/idv/agreement_controller_spec.rb @@ -5,11 +5,16 @@ let(:user) { create(:user) } + let(:ab_test_args) do + { sample_bucket1: :sample_value1, sample_bucket2: :sample_value2 } + end + before do stub_sign_in(user) stub_analytics subject.user_session['idv/doc_auth'] = {} subject.idv_session.welcome_visited = true + allow(subject).to receive(:ab_test_analytics_buckets).and_return(ab_test_args) end describe 'before_actions' do @@ -31,9 +36,11 @@ describe '#show' do let(:analytics_name) { 'IdV: doc auth agreement visited' } let(:analytics_args) do - { step: 'agreement', + { + step: 'agreement', analytics_id: 'Doc Auth', - irs_reproofing: false } + irs_reproofing: false, + }.merge(ab_test_args) end it 'renders the show template' do @@ -81,11 +88,13 @@ let(:analytics_name) { 'IdV: doc auth agreement submitted' } let(:analytics_args) do - { success: true, + { + success: true, errors: {}, step: 'agreement', analytics_id: 'Doc Auth', - irs_reproofing: false } + irs_reproofing: false, + }.merge(ab_test_args) end it 'sends analytics_submitted event with consent given' do diff --git a/spec/controllers/idv/getting_started_controller_spec.rb b/spec/controllers/idv/getting_started_controller_spec.rb index 0eaaa0ac9c0..8464710356f 100644 --- a/spec/controllers/idv/getting_started_controller_spec.rb +++ b/spec/controllers/idv/getting_started_controller_spec.rb @@ -5,10 +5,15 @@ let(:user) { create(:user) } + let(:ab_test_args) do + { sample_bucket1: :sample_value1, sample_bucket2: :sample_value2 } + end + before do stub_sign_in(user) stub_analytics subject.user_session['idv/doc_auth'] = {} + allow(subject).to receive(:ab_test_analytics_buckets).and_return(ab_test_args) end describe 'before_actions' do @@ -30,9 +35,11 @@ describe '#show' do let(:analytics_name) { 'IdV: doc auth getting_started visited' } let(:analytics_args) do - { step: 'getting_started', + { + step: 'getting_started', analytics_id: 'Doc Auth', - irs_reproofing: false } + irs_reproofing: false, + }.merge(ab_test_args) end it 'renders the show template' do @@ -88,11 +95,13 @@ let(:analytics_name) { 'IdV: doc auth getting_started submitted' } let(:analytics_args) do - { success: true, + { + success: true, errors: {}, step: 'getting_started', analytics_id: 'Doc Auth', - irs_reproofing: false } + irs_reproofing: false, + }.merge(ab_test_args) end it 'sends analytics_submitted event with consent given' do diff --git a/spec/controllers/idv/welcome_controller_spec.rb b/spec/controllers/idv/welcome_controller_spec.rb index ca531e9414b..74eca03573b 100644 --- a/spec/controllers/idv/welcome_controller_spec.rb +++ b/spec/controllers/idv/welcome_controller_spec.rb @@ -5,10 +5,15 @@ let(:user) { create(:user) } + let(:ab_test_args) do + { sample_bucket1: :sample_value1, sample_bucket2: :sample_value2 } + end + before do stub_sign_in(user) stub_analytics subject.user_session['idv/doc_auth'] = {} + allow(subject).to receive(:ab_test_analytics_buckets).and_return(ab_test_args) end describe 'before_actions' do @@ -37,9 +42,11 @@ describe '#show' do let(:analytics_name) { 'IdV: doc auth welcome visited' } let(:analytics_args) do - { step: 'welcome', + { + step: 'welcome', analytics_id: 'Doc Auth', - irs_reproofing: false } + irs_reproofing: false, + }.merge(ab_test_args) end it 'renders the show template' do @@ -87,9 +94,11 @@ let(:analytics_name) { 'IdV: doc auth welcome submitted' } let(:analytics_args) do - { step: 'welcome', + { + step: 'welcome', analytics_id: 'Doc Auth', - irs_reproofing: false } + irs_reproofing: false, + }.merge(ab_test_args) end it 'sends analytics_submitted event' do diff --git a/spec/features/idv/analytics_spec.rb b/spec/features/idv/analytics_spec.rb index 08f747de1bd..327da551dc4 100644 --- a/spec/features/idv/analytics_spec.rb +++ b/spec/features/idv/analytics_spec.rb @@ -32,11 +32,11 @@ let(:happy_path_events) do { 'IdV: intro visited' => {}, - 'IdV: doc auth welcome visited' => { step: 'welcome', analytics_id: 'Doc Auth', irs_reproofing: false }, - 'IdV: doc auth welcome submitted' => { step: 'welcome', analytics_id: 'Doc Auth', irs_reproofing: false }, - 'IdV: doc auth agreement visited' => { step: 'agreement', analytics_id: 'Doc Auth', irs_reproofing: false }, + 'IdV: doc auth welcome visited' => { step: 'welcome', analytics_id: 'Doc Auth', irs_reproofing: false, getting_started_ab_test_bucket: :welcome }, + 'IdV: doc auth welcome submitted' => { step: 'welcome', analytics_id: 'Doc Auth', irs_reproofing: false, getting_started_ab_test_bucket: :welcome }, + 'IdV: doc auth agreement visited' => { step: 'agreement', analytics_id: 'Doc Auth', irs_reproofing: false, acuant_sdk_upgrade_ab_test_bucket: :default, getting_started_ab_test_bucket: :welcome }, 'IdV: consent checkbox toggled' => { checked: true }, - 'IdV: doc auth agreement submitted' => { success: true, errors: {}, step: 'agreement', analytics_id: 'Doc Auth', irs_reproofing: false }, + 'IdV: doc auth agreement submitted' => { success: true, errors: {}, step: 'agreement', analytics_id: 'Doc Auth', irs_reproofing: false, acuant_sdk_upgrade_ab_test_bucket: :default, getting_started_ab_test_bucket: :welcome }, 'IdV: doc auth hybrid handoff visited' => { step: 'hybrid_handoff', acuant_sdk_upgrade_ab_test_bucket: :default, getting_started_ab_test_bucket: :welcome, analytics_id: 'Doc Auth', irs_reproofing: false }, 'IdV: doc auth hybrid handoff submitted' => { success: true, errors: {}, destination: :document_capture, flow_path: 'standard', step: 'hybrid_handoff', acuant_sdk_upgrade_ab_test_bucket: :default, getting_started_ab_test_bucket: :welcome, analytics_id: 'Doc Auth', irs_reproofing: false, skip_upload_step: false }, 'IdV: doc auth document_capture visited' => { flow_path: 'standard', step: 'document_capture', acuant_sdk_upgrade_ab_test_bucket: :default, getting_started_ab_test_bucket: :welcome, analytics_id: 'Doc Auth', irs_reproofing: false }, @@ -68,10 +68,10 @@ let(:gpo_path_events) do { 'IdV: intro visited' => {}, - 'IdV: doc auth welcome visited' => { step: 'welcome', analytics_id: 'Doc Auth', irs_reproofing: false }, - 'IdV: doc auth welcome submitted' => { step: 'welcome', analytics_id: 'Doc Auth', irs_reproofing: false }, - 'IdV: doc auth agreement visited' => { step: 'agreement', analytics_id: 'Doc Auth', irs_reproofing: false }, - 'IdV: doc auth agreement submitted' => { success: true, errors: {}, step: 'agreement', analytics_id: 'Doc Auth', irs_reproofing: false }, + 'IdV: doc auth welcome visited' => { step: 'welcome', analytics_id: 'Doc Auth', irs_reproofing: false, getting_started_ab_test_bucket: :welcome }, + 'IdV: doc auth welcome submitted' => { step: 'welcome', analytics_id: 'Doc Auth', irs_reproofing: false, getting_started_ab_test_bucket: :welcome }, + 'IdV: doc auth agreement visited' => { step: 'agreement', analytics_id: 'Doc Auth', irs_reproofing: false, acuant_sdk_upgrade_ab_test_bucket: :default, getting_started_ab_test_bucket: :welcome }, + 'IdV: doc auth agreement submitted' => { success: true, errors: {}, step: 'agreement', analytics_id: 'Doc Auth', irs_reproofing: false, acuant_sdk_upgrade_ab_test_bucket: :default, getting_started_ab_test_bucket: :welcome }, 'IdV: doc auth hybrid handoff visited' => { step: 'hybrid_handoff', acuant_sdk_upgrade_ab_test_bucket: :default, getting_started_ab_test_bucket: :welcome, analytics_id: 'Doc Auth', irs_reproofing: false }, 'IdV: doc auth hybrid handoff submitted' => { success: true, errors: {}, destination: :document_capture, flow_path: 'standard', step: 'hybrid_handoff', acuant_sdk_upgrade_ab_test_bucket: :default, getting_started_ab_test_bucket: :welcome, analytics_id: 'Doc Auth', irs_reproofing: false, skip_upload_step: false }, 'IdV: doc auth document_capture visited' => { flow_path: 'standard', step: 'document_capture', acuant_sdk_upgrade_ab_test_bucket: :default, getting_started_ab_test_bucket: :welcome, analytics_id: 'Doc Auth', irs_reproofing: false }, @@ -97,10 +97,10 @@ let(:in_person_path_events) do { - 'IdV: doc auth welcome visited' => { step: 'welcome', analytics_id: 'Doc Auth', irs_reproofing: false }, - 'IdV: doc auth welcome submitted' => { step: 'welcome', analytics_id: 'Doc Auth', irs_reproofing: false }, - 'IdV: doc auth agreement visited' => { step: 'agreement', analytics_id: 'Doc Auth', irs_reproofing: false }, - 'IdV: doc auth agreement submitted' => { success: true, errors: {}, step: 'agreement', analytics_id: 'Doc Auth', irs_reproofing: false }, + 'IdV: doc auth welcome visited' => { step: 'welcome', analytics_id: 'Doc Auth', irs_reproofing: false, getting_started_ab_test_bucket: :welcome }, + 'IdV: doc auth welcome submitted' => { step: 'welcome', analytics_id: 'Doc Auth', irs_reproofing: false, getting_started_ab_test_bucket: :welcome }, + 'IdV: doc auth agreement visited' => { step: 'agreement', analytics_id: 'Doc Auth', irs_reproofing: false, acuant_sdk_upgrade_ab_test_bucket: :default, getting_started_ab_test_bucket: :welcome }, + 'IdV: doc auth agreement submitted' => { success: true, errors: {}, step: 'agreement', analytics_id: 'Doc Auth', irs_reproofing: false, acuant_sdk_upgrade_ab_test_bucket: :default, getting_started_ab_test_bucket: :welcome }, 'IdV: doc auth hybrid handoff visited' => { step: 'hybrid_handoff', acuant_sdk_upgrade_ab_test_bucket: :default, getting_started_ab_test_bucket: :welcome, analytics_id: 'Doc Auth', irs_reproofing: false }, 'IdV: doc auth hybrid handoff submitted' => { success: true, errors: {}, destination: :document_capture, flow_path: 'standard', step: 'hybrid_handoff', acuant_sdk_upgrade_ab_test_bucket: :default, getting_started_ab_test_bucket: :welcome, analytics_id: 'Doc Auth', irs_reproofing: false, skip_upload_step: false }, 'IdV: doc auth document_capture visited' => { flow_path: 'standard', step: 'document_capture', acuant_sdk_upgrade_ab_test_bucket: :default, getting_started_ab_test_bucket: :welcome, analytics_id: 'Doc Auth', irs_reproofing: false }, From e1cbc3d20465d3c50233ed5e6fd7ce3d1ff4abc7 Mon Sep 17 00:00:00 2001 From: Sonia Connolly Date: Thu, 20 Jul 2023 16:04:18 -0700 Subject: [PATCH 16/20] Add A/B test buckets to verify proofing results analytics --- app/controllers/concerns/idv/verify_info_concern.rb | 2 +- spec/features/idv/analytics_spec.rb | 6 +++--- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/app/controllers/concerns/idv/verify_info_concern.rb b/app/controllers/concerns/idv/verify_info_concern.rb index 37fd362d35f..35d49b0914d 100644 --- a/app/controllers/concerns/idv/verify_info_concern.rb +++ b/app/controllers/concerns/idv/verify_info_concern.rb @@ -195,7 +195,7 @@ def async_state_done(current_async_state) address_line2_present: !pii[:address2].blank?, pii_like_keypaths: [[:errors, :ssn], [:response_body, :first_name], [:state_id, :state_id_jurisdiction]], - }, + }.merge(ab_test_analytics_buckets), ) log_idv_verification_submitted_event( success: form_response.success?, diff --git a/spec/features/idv/analytics_spec.rb b/spec/features/idv/analytics_spec.rb index 327da551dc4..49089301167 100644 --- a/spec/features/idv/analytics_spec.rb +++ b/spec/features/idv/analytics_spec.rb @@ -49,7 +49,7 @@ 'IdV: doc auth ssn submitted' => { success: true, errors: {}, flow_path: 'standard', step: 'ssn', acuant_sdk_upgrade_ab_test_bucket: :default, getting_started_ab_test_bucket: :welcome, analytics_id: 'Doc Auth', irs_reproofing: false }, 'IdV: doc auth verify visited' => { flow_path: 'standard', step: 'verify', acuant_sdk_upgrade_ab_test_bucket: :default, getting_started_ab_test_bucket: :welcome, analytics_id: 'Doc Auth', irs_reproofing: false }, 'IdV: doc auth verify submitted' => { flow_path: 'standard', step: 'verify', acuant_sdk_upgrade_ab_test_bucket: :default, getting_started_ab_test_bucket: :welcome, analytics_id: 'Doc Auth', irs_reproofing: false }, - 'IdV: doc auth verify proofing results' => { success: true, errors: {}, address_edited: false, address_line2_present: false, ssn_is_unique: true, proofing_results: { exception: nil, timed_out: false, threatmetrix_review_status: 'pass', context: { device_profiling_adjudication_reason: 'device_profiling_result_pass', double_address_verification: false, resolution_adjudication_reason: 'pass_resolution_and_state_id', should_proof_state_id: true, stages: { resolution: { success: true, errors: {}, exception: nil, timed_out: false, transaction_id: 'resolution-mock-transaction-id-123', reference: 'aaa-bbb-ccc', can_pass_with_additional_verification: false, attributes_requiring_additional_verification: [], vendor_name: 'ResolutionMock', vendor_workflow: nil }, residential_address: { errors: {}, exception: nil, reference: '', success: true, timed_out: false, transaction_id: '', vendor_name: 'ResidentialAddressNotRequired' }, state_id: { success: true, errors: {}, exception: nil, mva_exception: nil, timed_out: false, transaction_id: 'state-id-mock-transaction-id-456', vendor_name: 'StateIdMock', verified_attributes: [], state: 'MT', state_id_jurisdiction: 'ND', state_id_number: '#############' }, threatmetrix: threatmetrix_response } } } }, + 'IdV: doc auth verify proofing results' => { success: true, errors: {}, address_edited: false, address_line2_present: false, ssn_is_unique: true, acuant_sdk_upgrade_ab_test_bucket: :default, getting_started_ab_test_bucket: :welcome, proofing_results: { exception: nil, timed_out: false, threatmetrix_review_status: 'pass', context: { device_profiling_adjudication_reason: 'device_profiling_result_pass', double_address_verification: false, resolution_adjudication_reason: 'pass_resolution_and_state_id', should_proof_state_id: true, stages: { resolution: { success: true, errors: {}, exception: nil, timed_out: false, transaction_id: 'resolution-mock-transaction-id-123', reference: 'aaa-bbb-ccc', can_pass_with_additional_verification: false, attributes_requiring_additional_verification: [], vendor_name: 'ResolutionMock', vendor_workflow: nil }, residential_address: { errors: {}, exception: nil, reference: '', success: true, timed_out: false, transaction_id: '', vendor_name: 'ResidentialAddressNotRequired' }, state_id: { success: true, errors: {}, exception: nil, mva_exception: nil, timed_out: false, transaction_id: 'state-id-mock-transaction-id-456', vendor_name: 'StateIdMock', verified_attributes: [], state: 'MT', state_id_jurisdiction: 'ND', state_id_number: '#############' }, threatmetrix: threatmetrix_response } } } }, 'IdV: phone of record visited' => { proofing_components: { document_check: 'mock', document_type: 'state_id', source_check: 'aamva', resolution_check: 'lexis_nexis', threatmetrix: threatmetrix, threatmetrix_review_status: 'pass' } }, 'IdV: phone confirmation form' => { success: true, errors: {}, phone_type: :mobile, types: [:fixed_or_mobile], carrier: 'Test Mobile Carrier', country_code: 'US', area_code: '202', proofing_components: { document_check: 'mock', document_type: 'state_id', source_check: 'aamva', resolution_check: 'lexis_nexis', threatmetrix: threatmetrix, threatmetrix_review_status: 'pass' }, otp_delivery_preference: 'sms' }, 'IdV: phone confirmation vendor' => { success: true, errors: {}, vendor: { exception: nil, vendor_name: 'AddressMock', transaction_id: 'address-mock-transaction-id-123', timed_out: false, reference: '' }, new_phone_added: false, proofing_components: { document_check: 'mock', document_type: 'state_id', source_check: 'aamva', resolution_check: 'lexis_nexis', threatmetrix: threatmetrix, threatmetrix_review_status: 'pass', address_check: 'lexis_nexis_address' }, area_code: '202', country_code: 'US', phone_fingerprint: anything }, @@ -84,7 +84,7 @@ 'IdV: doc auth ssn submitted' => { success: true, errors: {}, flow_path: 'standard', step: 'ssn', acuant_sdk_upgrade_ab_test_bucket: :default, getting_started_ab_test_bucket: :welcome, analytics_id: 'Doc Auth', irs_reproofing: false }, 'IdV: doc auth verify visited' => { flow_path: 'standard', step: 'verify', acuant_sdk_upgrade_ab_test_bucket: :default, getting_started_ab_test_bucket: :welcome, analytics_id: 'Doc Auth', irs_reproofing: false }, 'IdV: doc auth verify submitted' => { flow_path: 'standard', step: 'verify', acuant_sdk_upgrade_ab_test_bucket: :default, getting_started_ab_test_bucket: :welcome, analytics_id: 'Doc Auth', irs_reproofing: false }, - 'IdV: doc auth verify proofing results' => { success: true, errors: {}, address_edited: false, address_line2_present: false, ssn_is_unique: true, proofing_results: { exception: nil, timed_out: false, threatmetrix_review_status: 'pass', context: { device_profiling_adjudication_reason: 'device_profiling_result_pass', resolution_adjudication_reason: 'pass_resolution_and_state_id', double_address_verification: false, should_proof_state_id: true, stages: { resolution: { success: true, errors: {}, exception: nil, timed_out: false, transaction_id: 'resolution-mock-transaction-id-123', reference: 'aaa-bbb-ccc', can_pass_with_additional_verification: false, attributes_requiring_additional_verification: [], vendor_name: 'ResolutionMock', vendor_workflow: nil }, residential_address: { errors: {}, exception: nil, reference: '', success: true, timed_out: false, transaction_id: '', vendor_name: 'ResidentialAddressNotRequired' }, state_id: { success: true, errors: {}, exception: nil, mva_exception: nil, timed_out: false, transaction_id: 'state-id-mock-transaction-id-456', vendor_name: 'StateIdMock', verified_attributes: [], state: 'MT', state_id_jurisdiction: 'ND', state_id_number: '#############' }, threatmetrix: threatmetrix_response } } } }, + 'IdV: doc auth verify proofing results' => { success: true, errors: {}, address_edited: false, address_line2_present: false, ssn_is_unique: true, acuant_sdk_upgrade_ab_test_bucket: :default, getting_started_ab_test_bucket: :welcome, proofing_results: { exception: nil, timed_out: false, threatmetrix_review_status: 'pass', context: { device_profiling_adjudication_reason: 'device_profiling_result_pass', resolution_adjudication_reason: 'pass_resolution_and_state_id', double_address_verification: false, should_proof_state_id: true, stages: { resolution: { success: true, errors: {}, exception: nil, timed_out: false, transaction_id: 'resolution-mock-transaction-id-123', reference: 'aaa-bbb-ccc', can_pass_with_additional_verification: false, attributes_requiring_additional_verification: [], vendor_name: 'ResolutionMock', vendor_workflow: nil }, residential_address: { errors: {}, exception: nil, reference: '', success: true, timed_out: false, transaction_id: '', vendor_name: 'ResidentialAddressNotRequired' }, state_id: { success: true, errors: {}, exception: nil, mva_exception: nil, timed_out: false, transaction_id: 'state-id-mock-transaction-id-456', vendor_name: 'StateIdMock', verified_attributes: [], state: 'MT', state_id_jurisdiction: 'ND', state_id_number: '#############' }, threatmetrix: threatmetrix_response } } } }, 'IdV: phone of record visited' => { proofing_components: { document_check: 'mock', document_type: 'state_id', source_check: 'aamva', resolution_check: 'lexis_nexis', threatmetrix: threatmetrix, threatmetrix_review_status: 'pass' } }, 'IdV: USPS address letter requested' => { resend: false, proofing_components: { document_check: 'mock', document_type: 'state_id', source_check: 'aamva', resolution_check: 'lexis_nexis', threatmetrix: threatmetrix, threatmetrix_review_status: 'pass' } }, 'IdV: review info visited' => { address_verification_method: 'gpo', proofing_components: { document_check: 'mock', document_type: 'state_id', source_check: 'aamva', resolution_check: 'lexis_nexis', threatmetrix: threatmetrix, threatmetrix_review_status: 'pass', address_check: 'gpo_letter' } }, @@ -121,7 +121,7 @@ 'IdV: doc auth ssn submitted' => { analytics_id: 'In Person Proofing', success: true, step: 'ssn', flow_path: 'standard', step_count: 1, irs_reproofing: false, errors: {}, same_address_as_id: true }, 'IdV: doc auth verify visited' => { analytics_id: 'In Person Proofing', step: 'verify', flow_path: 'standard', irs_reproofing: false, same_address_as_id: true, getting_started_ab_test_bucket: :welcome }, 'IdV: doc auth verify submitted' => { analytics_id: 'In Person Proofing', step: 'verify', flow_path: 'standard', irs_reproofing: false, same_address_as_id: true, getting_started_ab_test_bucket: :welcome }, - 'IdV: doc auth verify proofing results' => { success: true, errors: {}, address_edited: false, address_line2_present: false, ssn_is_unique: true, proofing_results: { exception: nil, timed_out: false, threatmetrix_review_status: 'pass', context: { device_profiling_adjudication_reason: 'device_profiling_result_pass', double_address_verification: false, resolution_adjudication_reason: 'pass_resolution_and_state_id', should_proof_state_id: true, stages: { resolution: { success: true, errors: {}, exception: nil, timed_out: false, transaction_id: 'resolution-mock-transaction-id-123', reference: 'aaa-bbb-ccc', can_pass_with_additional_verification: false, attributes_requiring_additional_verification: [], vendor_name: 'ResolutionMock', vendor_workflow: nil }, residential_address: { errors: {}, exception: nil, reference: '', success: true, timed_out: false, transaction_id: '', vendor_name: 'ResidentialAddressNotRequired' }, state_id: { success: true, errors: {}, exception: nil, mva_exception: nil, timed_out: false, transaction_id: 'state-id-mock-transaction-id-456', vendor_name: 'StateIdMock', verified_attributes: [], state: 'MT', state_id_jurisdiction: 'ND', state_id_number: '#############' }, threatmetrix: threatmetrix_response } } } }, + 'IdV: doc auth verify proofing results' => { success: true, errors: {}, address_edited: false, address_line2_present: false, ssn_is_unique: true, getting_started_ab_test_bucket: :welcome, proofing_results: { exception: nil, timed_out: false, threatmetrix_review_status: 'pass', context: { device_profiling_adjudication_reason: 'device_profiling_result_pass', double_address_verification: false, resolution_adjudication_reason: 'pass_resolution_and_state_id', should_proof_state_id: true, stages: { resolution: { success: true, errors: {}, exception: nil, timed_out: false, transaction_id: 'resolution-mock-transaction-id-123', reference: 'aaa-bbb-ccc', can_pass_with_additional_verification: false, attributes_requiring_additional_verification: [], vendor_name: 'ResolutionMock', vendor_workflow: nil }, residential_address: { errors: {}, exception: nil, reference: '', success: true, timed_out: false, transaction_id: '', vendor_name: 'ResidentialAddressNotRequired' }, state_id: { success: true, errors: {}, exception: nil, mva_exception: nil, timed_out: false, transaction_id: 'state-id-mock-transaction-id-456', vendor_name: 'StateIdMock', verified_attributes: [], state: 'MT', state_id_jurisdiction: 'ND', state_id_number: '#############' }, threatmetrix: threatmetrix_response } } } }, 'IdV: phone confirmation form' => { success: true, errors: {}, phone_type: :mobile, types: [:fixed_or_mobile], carrier: 'Test Mobile Carrier', country_code: 'US', area_code: '202', proofing_components: { document_check: 'usps', resolution_check: 'lexis_nexis', threatmetrix: threatmetrix, threatmetrix_review_status: 'pass', source_check: 'aamva' }, otp_delivery_preference: 'sms' }, 'IdV: phone confirmation vendor' => { success: true, errors: {}, vendor: { exception: nil, vendor_name: 'AddressMock', transaction_id: 'address-mock-transaction-id-123', timed_out: false, reference: '' }, new_phone_added: false, proofing_components: { address_check: 'lexis_nexis_address', document_check: 'usps', resolution_check: 'lexis_nexis', threatmetrix: threatmetrix, threatmetrix_review_status: 'pass', source_check: 'aamva' }, area_code: '202', country_code: 'US', phone_fingerprint: anything }, 'IdV: phone confirmation otp sent' => { success: true, otp_delivery_preference: :sms, country_code: 'US', area_code: '202', proofing_components: { address_check: 'lexis_nexis_address', document_check: 'usps', resolution_check: 'lexis_nexis', threatmetrix: threatmetrix, threatmetrix_review_status: 'pass', source_check: 'aamva' }, adapter: :test, errors: {}, phone_fingerprint: anything, rate_limit_exceeded: false, telephony_response: anything }, From 61ad8228f80a60d6c31c8ec9b88eb39d6ce3f82a Mon Sep 17 00:00:00 2001 From: Sonia Connolly Date: Fri, 21 Jul 2023 13:14:50 -0700 Subject: [PATCH 17/20] Clean up getting_started_ab_test_concern_spec Co-authored-by: Zach Margolis --- .../getting_started_ab_test_concern_spec.rb | 30 +++++++------------ 1 file changed, 10 insertions(+), 20 deletions(-) diff --git a/spec/controllers/concerns/idv/getting_started_ab_test_concern_spec.rb b/spec/controllers/concerns/idv/getting_started_ab_test_concern_spec.rb index 199f8bff96c..681b086c301 100644 --- a/spec/controllers/concerns/idv/getting_started_ab_test_concern_spec.rb +++ b/spec/controllers/concerns/idv/getting_started_ab_test_concern_spec.rb @@ -1,22 +1,19 @@ require 'rails_helper' -RSpec.describe 'GettingStartedAbTestConcern' do +RSpec.describe Idv::GettingStartedAbTestConcern do let(:user) { create(:user, :fully_registered, email: 'old_email@example.com') } - module Idv - class StepController < ApplicationController - include GettingStartedAbTestConcern + controller(ApplicationController) do + include Idv::GettingStartedAbTestConcern - def show - render plain: 'Hello' - end + before_action :maybe_redirect_for_getting_started_ab_test + + def index + render plain: 'Hello' end end describe '#getting_started_ab_test_bucket' do - controller Idv::StepController do - end - before do allow(controller).to receive(:current_user).and_return(user) allow(AbTests::IDV_GETTING_STARTED).to receive(:bucket) do |discriminator| @@ -44,15 +41,8 @@ def show end context '#maybe_redirect_for_getting_started_ab_test' do - controller Idv::StepController do - before_action :maybe_redirect_for_getting_started_ab_test - end - before do sign_in(user) - routes.draw do - get 'show' => 'idv/step#show' - end end context 'A/B test specifies getting started page' do @@ -62,7 +52,7 @@ def show end it 'redirects to idv_getting_started_url' do - get :show + get :index expect(response).to redirect_to(idv_getting_started_url) end @@ -75,7 +65,7 @@ def show end it 'does not redirect users away from welcome page' do - get :show + get :index expect(response.body).to eq('Hello') expect(response.status).to eq(200) @@ -89,7 +79,7 @@ def show end it 'does not redirect users away from welcome page' do - get :show + get :index expect(response.body).to eq('Hello') expect(response.status).to eq(200) From a44cc619a2e7be44f1c6883cf4ed1233e3607e2b Mon Sep 17 00:00:00 2001 From: Sonia Connolly Date: Fri, 21 Jul 2023 13:35:35 -0700 Subject: [PATCH 18/20] Extract method to choose document_capture_user or current_user to make more testable, and add specs --- .../idv/getting_started_ab_test_concern.rb | 15 ++++++------ .../getting_started_ab_test_concern_spec.rb | 24 +++++++++++++++++++ 2 files changed, 32 insertions(+), 7 deletions(-) diff --git a/app/controllers/concerns/idv/getting_started_ab_test_concern.rb b/app/controllers/concerns/idv/getting_started_ab_test_concern.rb index a280182958d..97c191110a3 100644 --- a/app/controllers/concerns/idv/getting_started_ab_test_concern.rb +++ b/app/controllers/concerns/idv/getting_started_ab_test_concern.rb @@ -1,14 +1,15 @@ module Idv module GettingStartedAbTestConcern def getting_started_ab_test_bucket - uuid = - if defined?(document_capture_user) # hybrid flow - document_capture_user.uuid - else - current_user.uuid - end + AbTests::IDV_GETTING_STARTED.bucket(getting_started_user.uuid) + end - AbTests::IDV_GETTING_STARTED.bucket(uuid) + def getting_started_user + if defined?(document_capture_user) # hybrid flow + document_capture_user + else + current_user + end end def maybe_redirect_for_getting_started_ab_test diff --git a/spec/controllers/concerns/idv/getting_started_ab_test_concern_spec.rb b/spec/controllers/concerns/idv/getting_started_ab_test_concern_spec.rb index 681b086c301..518d5131f40 100644 --- a/spec/controllers/concerns/idv/getting_started_ab_test_concern_spec.rb +++ b/spec/controllers/concerns/idv/getting_started_ab_test_concern_spec.rb @@ -40,6 +40,30 @@ def index end end + describe '#getting_started_user' do + let(:document_capture_user) { create(:user) } + let(:current_user) { create(:user) } + before do + allow(controller).to receive(:current_user).and_return(current_user) + end + + context 'when document_capture_user is defined (hybrid flow)' do + before do + allow(controller).to receive(:document_capture_user).and_return(document_capture_user) + end + + it 'uses the document_capture_user to choose a bucket' do + expect(controller.getting_started_user).to eq(document_capture_user) + end + end + + context 'when falling back to current_user' do + it 'falls back to current_user when document_capture_user undefined' do + expect(controller.getting_started_user).to eq(current_user) + end + end + end + context '#maybe_redirect_for_getting_started_ab_test' do before do sign_in(user) From 64fd4f16076273ed15719c0a8978fec61e20e8f9 Mon Sep 17 00:00:00 2001 From: Sonia Connolly Date: Fri, 21 Jul 2023 13:49:43 -0700 Subject: [PATCH 19/20] Add ab test analytics to review_controller visited and submitted events --- app/controllers/idv/review_controller.rb | 8 +++++++- spec/controllers/idv/review_controller_spec.rb | 9 +++++++++ 2 files changed, 16 insertions(+), 1 deletion(-) diff --git a/app/controllers/idv/review_controller.rb b/app/controllers/idv/review_controller.rb index 6a1437a45a0..da22db72690 100644 --- a/app/controllers/idv/review_controller.rb +++ b/app/controllers/idv/review_controller.rb @@ -24,6 +24,7 @@ def confirm_current_password gpo_verification_pending: current_user.gpo_verification_pending_profile?, fraud_review_pending: fraud_review_pending?, fraud_rejection: fraud_rejection?, + **ab_test_analytics_buckets, ) irs_attempts_api_tracker.idv_password_entered(success: false) @@ -34,7 +35,10 @@ def confirm_current_password def new Funnel::DocAuth::RegisterStep.new(current_user.id, current_sp&.issuer). call(:encrypt, :view, true) - analytics.idv_review_info_visited(address_verification_method: address_verification_method) + analytics.idv_review_info_visited( + address_verification_method: address_verification_method, + **ab_test_analytics_buckets, + ) gpo_mail_service = Idv::GpoMail.new(current_user) flash_now = flash.now @@ -67,6 +71,7 @@ def create fraud_rejection: idv_session.profile.fraud_rejection?, gpo_verification_pending: idv_session.profile.gpo_verification_pending?, deactivation_reason: idv_session.profile.deactivation_reason, + **ab_test_analytics_buckets, ) Funnel::DocAuth::RegisterStep.new(current_user.id, current_sp&.issuer). call(:verified, :view, true) @@ -76,6 +81,7 @@ def create fraud_rejection: idv_session.profile.fraud_rejection?, gpo_verification_pending: idv_session.profile.gpo_verification_pending?, deactivation_reason: idv_session.profile.deactivation_reason, + **ab_test_analytics_buckets, ) return unless FeatureManagement.reveal_gpo_code? diff --git a/spec/controllers/idv/review_controller_spec.rb b/spec/controllers/idv/review_controller_spec.rb index 472dee4e527..dfa499b8a79 100644 --- a/spec/controllers/idv/review_controller_spec.rb +++ b/spec/controllers/idv/review_controller_spec.rb @@ -25,9 +25,14 @@ idv_session end + let(:ab_test_args) do + { sample_bucket1: :sample_value1, sample_bucket2: :sample_value2 } + end + before do stub_analytics allow(IdentityConfig.store).to receive(:usps_mock_fallback).and_return(false) + allow(subject).to receive(:ab_test_analytics_buckets).and_return(ab_test_args) end describe 'before_actions' do @@ -255,6 +260,7 @@ def show gpo_verification_pending: false, proofing_components: nil, deactivation_reason: nil, + **ab_test_args, ) end end @@ -277,6 +283,7 @@ def show gpo_verification_pending: false, proofing_components: nil, deactivation_reason: anything, + **ab_test_args, ) expect(@analytics).to have_logged_event( 'IdV: final resolution', @@ -613,6 +620,7 @@ def show gpo_verification_pending: false, proofing_components: nil, deactivation_reason: nil, + **ab_test_args, ) expect(@analytics).to have_logged_event( 'IdV: final resolution', @@ -622,6 +630,7 @@ def show gpo_verification_pending: false, proofing_components: nil, deactivation_reason: nil, + **ab_test_args, ) end From 4c329c8534f4f14dfe77bcbe73203a741e414173 Mon Sep 17 00:00:00 2001 From: Sonia Connolly Date: Fri, 21 Jul 2023 14:07:23 -0700 Subject: [PATCH 20/20] Fix analytics_spec for review events --- spec/features/idv/analytics_spec.rb | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/spec/features/idv/analytics_spec.rb b/spec/features/idv/analytics_spec.rb index 49089301167..7ee0c172226 100644 --- a/spec/features/idv/analytics_spec.rb +++ b/spec/features/idv/analytics_spec.rb @@ -56,9 +56,9 @@ 'IdV: phone confirmation otp sent' => { success: true, otp_delivery_preference: :sms, country_code: 'US', area_code: '202', proofing_components: { document_check: 'mock', document_type: 'state_id', source_check: 'aamva', resolution_check: 'lexis_nexis', threatmetrix: threatmetrix, threatmetrix_review_status: 'pass', address_check: 'lexis_nexis_address' }, adapter: :test, errors: {}, phone_fingerprint: anything, rate_limit_exceeded: false, telephony_response: anything }, 'IdV: phone confirmation otp visited' => { proofing_components: { document_check: 'mock', document_type: 'state_id', source_check: 'aamva', resolution_check: 'lexis_nexis', threatmetrix: threatmetrix, threatmetrix_review_status: 'pass', address_check: 'lexis_nexis_address' } }, 'IdV: phone confirmation otp submitted' => { success: true, code_expired: false, code_matches: true, second_factor_attempts_count: 0, second_factor_locked_at: nil, proofing_components: { document_check: 'mock', document_type: 'state_id', source_check: 'aamva', resolution_check: 'lexis_nexis', threatmetrix: threatmetrix, threatmetrix_review_status: 'pass', address_check: 'lexis_nexis_address' }, errors: {} }, - 'IdV: review info visited' => { address_verification_method: 'phone', proofing_components: { document_check: 'mock', document_type: 'state_id', source_check: 'aamva', resolution_check: 'lexis_nexis', threatmetrix: threatmetrix, threatmetrix_review_status: 'pass', address_check: 'lexis_nexis_address' } }, - 'IdV: review complete' => { success: true, proofing_components: { document_check: 'mock', document_type: 'state_id', source_check: 'aamva', resolution_check: 'lexis_nexis', threatmetrix: threatmetrix, threatmetrix_review_status: 'pass', address_check: 'lexis_nexis_address' }, fraud_review_pending: false, fraud_rejection: false, gpo_verification_pending: false, deactivation_reason: nil }, - 'IdV: final resolution' => { success: true, proofing_components: { document_check: 'mock', document_type: 'state_id', source_check: 'aamva', resolution_check: 'lexis_nexis', threatmetrix: threatmetrix, threatmetrix_review_status: 'pass', address_check: 'lexis_nexis_address' }, fraud_review_pending: false, fraud_rejection: false, gpo_verification_pending: false, deactivation_reason: nil }, + 'IdV: review info visited' => { address_verification_method: 'phone', acuant_sdk_upgrade_ab_test_bucket: :default, getting_started_ab_test_bucket: :welcome, proofing_components: { document_check: 'mock', document_type: 'state_id', source_check: 'aamva', resolution_check: 'lexis_nexis', threatmetrix: threatmetrix, threatmetrix_review_status: 'pass', address_check: 'lexis_nexis_address' } }, + 'IdV: review complete' => { success: true, acuant_sdk_upgrade_ab_test_bucket: :default, getting_started_ab_test_bucket: :welcome, proofing_components: { document_check: 'mock', document_type: 'state_id', source_check: 'aamva', resolution_check: 'lexis_nexis', threatmetrix: threatmetrix, threatmetrix_review_status: 'pass', address_check: 'lexis_nexis_address' }, fraud_review_pending: false, fraud_rejection: false, gpo_verification_pending: false, deactivation_reason: nil }, + 'IdV: final resolution' => { success: true, acuant_sdk_upgrade_ab_test_bucket: :default, getting_started_ab_test_bucket: :welcome, proofing_components: { document_check: 'mock', document_type: 'state_id', source_check: 'aamva', resolution_check: 'lexis_nexis', threatmetrix: threatmetrix, threatmetrix_review_status: 'pass', address_check: 'lexis_nexis_address' }, fraud_review_pending: false, fraud_rejection: false, gpo_verification_pending: false, deactivation_reason: nil }, 'IdV: personal key visited' => { address_verification_method: 'phone', proofing_components: { document_check: 'mock', document_type: 'state_id', source_check: 'aamva', resolution_check: 'lexis_nexis', threatmetrix: threatmetrix, threatmetrix_review_status: 'pass', address_check: 'lexis_nexis_address' } }, 'IdV: personal key acknowledgment toggled' => { checked: true, proofing_components: { document_check: 'mock', document_type: 'state_id', source_check: 'aamva', resolution_check: 'lexis_nexis', threatmetrix: threatmetrix, threatmetrix_review_status: 'pass', address_check: 'lexis_nexis_address' } }, 'IdV: personal key submitted' => { address_verification_method: 'phone', proofing_components: { document_check: 'mock', document_type: 'state_id', source_check: 'aamva', resolution_check: 'lexis_nexis', threatmetrix: threatmetrix, threatmetrix_review_status: 'pass', address_check: 'lexis_nexis_address' }, fraud_review_pending: false, fraud_rejection: false, deactivation_reason: nil }, @@ -87,10 +87,10 @@ 'IdV: doc auth verify proofing results' => { success: true, errors: {}, address_edited: false, address_line2_present: false, ssn_is_unique: true, acuant_sdk_upgrade_ab_test_bucket: :default, getting_started_ab_test_bucket: :welcome, proofing_results: { exception: nil, timed_out: false, threatmetrix_review_status: 'pass', context: { device_profiling_adjudication_reason: 'device_profiling_result_pass', resolution_adjudication_reason: 'pass_resolution_and_state_id', double_address_verification: false, should_proof_state_id: true, stages: { resolution: { success: true, errors: {}, exception: nil, timed_out: false, transaction_id: 'resolution-mock-transaction-id-123', reference: 'aaa-bbb-ccc', can_pass_with_additional_verification: false, attributes_requiring_additional_verification: [], vendor_name: 'ResolutionMock', vendor_workflow: nil }, residential_address: { errors: {}, exception: nil, reference: '', success: true, timed_out: false, transaction_id: '', vendor_name: 'ResidentialAddressNotRequired' }, state_id: { success: true, errors: {}, exception: nil, mva_exception: nil, timed_out: false, transaction_id: 'state-id-mock-transaction-id-456', vendor_name: 'StateIdMock', verified_attributes: [], state: 'MT', state_id_jurisdiction: 'ND', state_id_number: '#############' }, threatmetrix: threatmetrix_response } } } }, 'IdV: phone of record visited' => { proofing_components: { document_check: 'mock', document_type: 'state_id', source_check: 'aamva', resolution_check: 'lexis_nexis', threatmetrix: threatmetrix, threatmetrix_review_status: 'pass' } }, 'IdV: USPS address letter requested' => { resend: false, proofing_components: { document_check: 'mock', document_type: 'state_id', source_check: 'aamva', resolution_check: 'lexis_nexis', threatmetrix: threatmetrix, threatmetrix_review_status: 'pass' } }, - 'IdV: review info visited' => { address_verification_method: 'gpo', proofing_components: { document_check: 'mock', document_type: 'state_id', source_check: 'aamva', resolution_check: 'lexis_nexis', threatmetrix: threatmetrix, threatmetrix_review_status: 'pass', address_check: 'gpo_letter' } }, + 'IdV: review info visited' => { address_verification_method: 'gpo', acuant_sdk_upgrade_ab_test_bucket: :default, getting_started_ab_test_bucket: :welcome, proofing_components: { document_check: 'mock', document_type: 'state_id', source_check: 'aamva', resolution_check: 'lexis_nexis', threatmetrix: threatmetrix, threatmetrix_review_status: 'pass', address_check: 'gpo_letter' } }, 'IdV: USPS address letter enqueued' => { enqueued_at: Time.zone.now.utc, resend: false, proofing_components: { document_check: 'mock', document_type: 'state_id', source_check: 'aamva', resolution_check: 'lexis_nexis', threatmetrix: threatmetrix, threatmetrix_review_status: 'pass', address_check: 'gpo_letter' } }, - 'IdV: review complete' => { success: true, proofing_components: { document_check: 'mock', document_type: 'state_id', source_check: 'aamva', resolution_check: 'lexis_nexis', threatmetrix: threatmetrix, threatmetrix_review_status: 'pass', address_check: 'gpo_letter' }, fraud_review_pending: false, fraud_rejection: false, gpo_verification_pending: true, deactivation_reason: nil }, - 'IdV: final resolution' => { success: true, proofing_components: { document_check: 'mock', document_type: 'state_id', source_check: 'aamva', resolution_check: 'lexis_nexis', threatmetrix: threatmetrix, threatmetrix_review_status: 'pass', address_check: 'gpo_letter' }, fraud_review_pending: false, fraud_rejection: false, gpo_verification_pending: true, deactivation_reason: nil }, + 'IdV: review complete' => { success: true, acuant_sdk_upgrade_ab_test_bucket: :default, getting_started_ab_test_bucket: :welcome, proofing_components: { document_check: 'mock', document_type: 'state_id', source_check: 'aamva', resolution_check: 'lexis_nexis', threatmetrix: threatmetrix, threatmetrix_review_status: 'pass', address_check: 'gpo_letter' }, fraud_review_pending: false, fraud_rejection: false, gpo_verification_pending: true, deactivation_reason: nil }, + 'IdV: final resolution' => { success: true, acuant_sdk_upgrade_ab_test_bucket: :default, getting_started_ab_test_bucket: :welcome, proofing_components: { document_check: 'mock', document_type: 'state_id', source_check: 'aamva', resolution_check: 'lexis_nexis', threatmetrix: threatmetrix, threatmetrix_review_status: 'pass', address_check: 'gpo_letter' }, fraud_review_pending: false, fraud_rejection: false, gpo_verification_pending: true, deactivation_reason: nil }, 'IdV: come back later visited' => { proofing_components: { document_check: 'mock', document_type: 'state_id', source_check: 'aamva', resolution_check: 'lexis_nexis', threatmetrix: threatmetrix, threatmetrix_review_status: 'pass', address_check: 'gpo_letter' } }, } end @@ -127,9 +127,9 @@ 'IdV: phone confirmation otp sent' => { success: true, otp_delivery_preference: :sms, country_code: 'US', area_code: '202', proofing_components: { address_check: 'lexis_nexis_address', document_check: 'usps', resolution_check: 'lexis_nexis', threatmetrix: threatmetrix, threatmetrix_review_status: 'pass', source_check: 'aamva' }, adapter: :test, errors: {}, phone_fingerprint: anything, rate_limit_exceeded: false, telephony_response: anything }, 'IdV: phone confirmation otp visited' => { proofing_components: { address_check: 'lexis_nexis_address', document_check: 'usps', resolution_check: 'lexis_nexis', threatmetrix: threatmetrix, threatmetrix_review_status: 'pass', source_check: 'aamva' } }, 'IdV: phone confirmation otp submitted' => { success: true, code_expired: false, code_matches: true, second_factor_attempts_count: 0, second_factor_locked_at: nil, proofing_components: { document_check: 'usps', source_check: 'aamva', resolution_check: 'lexis_nexis', threatmetrix: threatmetrix, threatmetrix_review_status: 'pass', address_check: 'lexis_nexis_address' }, errors: {} }, - 'IdV: review info visited' => { proofing_components: { document_check: 'usps', source_check: 'aamva', resolution_check: 'lexis_nexis', threatmetrix: threatmetrix, threatmetrix_review_status: 'pass', address_check: 'lexis_nexis_address' }, address_verification_method: 'phone' }, - 'IdV: review complete' => { success: true, proofing_components: { document_check: 'usps', source_check: 'aamva', resolution_check: 'lexis_nexis', threatmetrix: threatmetrix, threatmetrix_review_status: 'pass', address_check: 'lexis_nexis_address' }, fraud_review_pending: false, fraud_rejection: false, gpo_verification_pending: false, deactivation_reason: 'in_person_verification_pending' }, - 'IdV: final resolution' => { success: true, proofing_components: { document_check: 'usps', source_check: 'aamva', resolution_check: 'lexis_nexis', threatmetrix: threatmetrix, threatmetrix_review_status: 'pass', address_check: 'lexis_nexis_address' }, fraud_review_pending: false, fraud_rejection: false, gpo_verification_pending: false, deactivation_reason: 'in_person_verification_pending' }, + 'IdV: review info visited' => { acuant_sdk_upgrade_ab_test_bucket: :default, getting_started_ab_test_bucket: :welcome, proofing_components: { document_check: 'usps', source_check: 'aamva', resolution_check: 'lexis_nexis', threatmetrix: threatmetrix, threatmetrix_review_status: 'pass', address_check: 'lexis_nexis_address' }, address_verification_method: 'phone' }, + 'IdV: review complete' => { success: true, acuant_sdk_upgrade_ab_test_bucket: :default, getting_started_ab_test_bucket: :welcome, proofing_components: { document_check: 'usps', source_check: 'aamva', resolution_check: 'lexis_nexis', threatmetrix: threatmetrix, threatmetrix_review_status: 'pass', address_check: 'lexis_nexis_address' }, fraud_review_pending: false, fraud_rejection: false, gpo_verification_pending: false, deactivation_reason: 'in_person_verification_pending' }, + 'IdV: final resolution' => { success: true, acuant_sdk_upgrade_ab_test_bucket: :default, getting_started_ab_test_bucket: :welcome, proofing_components: { document_check: 'usps', source_check: 'aamva', resolution_check: 'lexis_nexis', threatmetrix: threatmetrix, threatmetrix_review_status: 'pass', address_check: 'lexis_nexis_address' }, fraud_review_pending: false, fraud_rejection: false, gpo_verification_pending: false, deactivation_reason: 'in_person_verification_pending' }, 'IdV: personal key visited' => { proofing_components: { document_check: 'usps', source_check: 'aamva', resolution_check: 'lexis_nexis', threatmetrix: threatmetrix, threatmetrix_review_status: 'pass', address_check: 'lexis_nexis_address' }, address_verification_method: 'phone' }, 'IdV: personal key acknowledgment toggled' => { checked: true, proofing_components: { document_check: 'usps', source_check: 'aamva', resolution_check: 'lexis_nexis', threatmetrix: threatmetrix, threatmetrix_review_status: 'pass', address_check: 'lexis_nexis_address' } }, 'IdV: personal key submitted' => { proofing_components: { document_check: 'usps', source_check: 'aamva', resolution_check: 'lexis_nexis', threatmetrix: threatmetrix, threatmetrix_review_status: 'pass', address_check: 'lexis_nexis_address' }, address_verification_method: 'phone', fraud_review_pending: false, fraud_rejection: false, deactivation_reason: 'in_person_verification_pending' },