Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions app/controllers/idv/hybrid_handoff_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ def show
true
)

@phone_question_ab_test_bucket = phone_question_ab_test_bucket
render :show, locals: extra_view_variables
end

Expand Down
12 changes: 10 additions & 2 deletions app/views/idv/hybrid_handoff/show.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,11 @@
<% end %>

<%= render PageHeadingComponent.new do %>
<%= t('doc_auth.headings.hybrid_handoff') %>
<% if @phone_question_ab_test_bucket == :show_phone_question %>
<%= t('doc_auth.headings.upload_from_phone') %>
<% else %>
<%= t('doc_auth.headings.hybrid_handoff') %>
<% end %>
<% end %>

<p>
Expand All @@ -31,7 +35,11 @@
<%= t('doc_auth.info.tag') %>
</div>
<h2 class="margin-y-105">
<%= t('doc_auth.headings.upload_from_phone') %>
<% if @phone_question_ab_test_bucket == :show_phone_question %>
<%= t('doc_auth.headings.switch_to_phone') %>
<% else %>
<%= t('doc_auth.headings.upload_from_phone') %>
<% end %>
</h2>
<%= t('doc_auth.info.upload_from_phone') %>
<%= simple_form_for(
Expand Down
1 change: 1 addition & 0 deletions config/locales/doc_auth/en.yml
Original file line number Diff line number Diff line change
Expand Up @@ -149,6 +149,7 @@ en:
secure_account: Secure your account
ssn: Enter your Social Security number
ssn_update: Update your Social Security number
switch_to_phone: Switch to your phone
text_message: We sent a message to your phone
upload_from_computer: Continue on this computer
upload_from_phone: Use your phone to take photos
Expand Down
1 change: 1 addition & 0 deletions config/locales/doc_auth/es.yml
Original file line number Diff line number Diff line change
Expand Up @@ -179,6 +179,7 @@ es:
secure_account: Asegure su cuenta
ssn: Ingrese su número de Seguro Social
ssn_update: Actualice su número de Seguro Social
switch_to_phone: Cambiar al teléfono
text_message: Enviamos un mensaje a su teléfono
upload_from_computer: Continuar en esta computadora
upload_from_phone: Utilice su teléfono para tomar las fotos
Expand Down
1 change: 1 addition & 0 deletions config/locales/doc_auth/fr.yml
Original file line number Diff line number Diff line change
Expand Up @@ -185,6 +185,7 @@ fr:
secure_account: Sécuriser votre compte
ssn: Saisissez votre numéro de sécurité sociale
ssn_update: Mettre à jour votre numéro de Sécurité Sociale
switch_to_phone: Basculez vers votre téléphone
text_message: Nous avons envoyé un message à votre téléphone
upload_from_computer: Continuer sur cet ordinateur
upload_from_phone: Utilisez votre téléphone pour prendre des photos
Expand Down
15 changes: 15 additions & 0 deletions spec/features/idv/doc_auth/hybrid_handoff_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -155,6 +155,13 @@
timeout: timeout,
),
)

# expect to see the headings that reflect having
# :phone_question_ab_test_bucket set to :bypass_phone_question
expect(page).to have_selector('h1', text: t('doc_auth.headings.hybrid_handoff'))
expect(page).to have_selector('h2', text: t('doc_auth.headings.upload_from_phone'))
expect(page).not_to have_selector('h1', text: t('doc_auth.headings.upload_from_phone'))
expect(page).not_to have_selector('h2', text: t('doc_auth.headings.switch_to_phone'))
end
expect(fake_analytics).to have_logged_event(
'Rate Limit Reached',
Expand Down Expand Up @@ -219,6 +226,14 @@
),
)
end

# expect to see the headings that refelect having
# :phone_question_ab_test_bucket set to :show_phone_question
expect(page).to have_selector('h1', text: t('doc_auth.headings.upload_from_phone'))
expect(page).to have_selector('h2', text: t('doc_auth.headings.switch_to_phone'))
expect(page).not_to have_selector('h1', text: t('doc_auth.headings.hybrid_handoff'))
expect(page).not_to have_selector('h2', text: t('doc_auth.headings.upload_from_phone'))

expect(fake_analytics).to have_logged_event(
'Rate Limit Reached',
limiter_type: :idv_send_link,
Expand Down
40 changes: 40 additions & 0 deletions spec/views/idv/hybrid_handoff/show.html.erb_spec.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
require 'rails_helper'

RSpec.describe 'idv/hybrid_handoff/show.html.erb' do
before do
allow(view).to receive(:current_user).and_return(@user)
@idv_form = Idv::PhoneForm.new(user: build_stubbed(:user), previous_params: nil)
end

subject(:rendered) do
render template: 'idv/hybrid_handoff/show', locals: {
idv_phone_form: @idv_form,
}
end

context 'with show phone question' do
before do
@phone_question_ab_test_bucket = :show_phone_question
end

it 'displays the expected headings from the "b" case' do
expect(rendered).to have_selector('h1', text: t('doc_auth.headings.upload_from_phone'))
expect(rendered).to have_selector('h2', text: t('doc_auth.headings.switch_to_phone'))
expect(rendered).not_to have_selector('h1', text: t('doc_auth.headings.hybrid_handoff'))
expect(rendered).not_to have_selector('h2', text: t('doc_auth.headings.upload_from_phone'))
end
end

context 'without show phone question' do
before do
@phone_question_ab_test_bucket = :bypass_phone_question
end

it 'displays the expected headings from the "a" case' do
expect(rendered).to have_selector('h1', text: t('doc_auth.headings.hybrid_handoff'))
expect(rendered).to have_selector('h2', text: t('doc_auth.headings.upload_from_phone'))
expect(rendered).not_to have_selector('h1', text: t('doc_auth.headings.upload_from_phone'))
expect(rendered).not_to have_selector('h2', text: t('doc_auth.headings.switch_to_phone'))
end
end
end