diff --git a/app/services/db/doc_auth_log/drop_off_rates_helper.rb b/app/services/db/doc_auth_log/drop_off_rates_helper.rb index c02e8fabb67..28df7f116ee 100644 --- a/app/services/db/doc_auth_log/drop_off_rates_helper.rb +++ b/app/services/db/doc_auth_log/drop_off_rates_helper.rb @@ -1,7 +1,7 @@ module Db module DocAuthLog module DropOffRatesHelper - STEPS = %w[welcome capture_document ssn verify_info phone + STEPS = %w[welcome agreement capture_document ssn verify_info phone encrypt personal_key verified].freeze private @@ -26,7 +26,7 @@ def select_count_from_profiles_where_verified_and_active def select_counts_from_doc_auth_logs <<~SQL - select count(welcome_view_at) as welcome, count(upload_view_at) as upload_option, + select count(welcome_view_at) as welcome, count(agreement_view_at) as agreement, count(upload_view_at) as upload_option, count(COALESCE(back_image_view_at,mobile_back_image_view_at,capture_mobile_back_image_view_at,present_cac_view_at)) as capture_document, count(COALESCE(ssn_view_at,enter_info_view_at)) as ssn, count(verify_view_at) as verify_info, diff --git a/app/services/funnel/doc_auth/register_step.rb b/app/services/funnel/doc_auth/register_step.rb index cf3d0e291d6..a11772fa926 100644 --- a/app/services/funnel/doc_auth/register_step.rb +++ b/app/services/funnel/doc_auth/register_step.rb @@ -2,6 +2,7 @@ module Funnel module DocAuth class RegisterStep TOKEN_WHITELIST = %i[ + agreement welcome upload send_link diff --git a/app/services/idv/flows/doc_auth_flow.rb b/app/services/idv/flows/doc_auth_flow.rb index 8711b4e5784..2074f0f6dfb 100644 --- a/app/services/idv/flows/doc_auth_flow.rb +++ b/app/services/idv/flows/doc_auth_flow.rb @@ -3,6 +3,7 @@ module Flows class DocAuthFlow < Flow::BaseFlow STEPS = { welcome: Idv::Steps::WelcomeStep, + agreement: Idv::Steps::AgreementStep, upload: Idv::Steps::UploadStep, send_link: Idv::Steps::SendLinkStep, link_sent: Idv::Steps::LinkSentStep, diff --git a/app/services/idv/steps/agreement_step.rb b/app/services/idv/steps/agreement_step.rb new file mode 100644 index 00000000000..76f822e41ac --- /dev/null +++ b/app/services/idv/steps/agreement_step.rb @@ -0,0 +1,23 @@ +module Idv + module Steps + class AgreementStep < DocAuthBaseStep + def call + end + + def form_submit + skip_to_capture if params[:skip_upload] + + Idv::ConsentForm.new.submit(consent_form_params) + end + + def skip_to_capture + # See: Idv::DocAuthController#update_if_skipping_upload + flow_session[:skip_upload_step] = true + end + + def consent_form_params + params.permit(:ial2_consent_given) + end + end + end +end diff --git a/app/services/idv/steps/welcome_step.rb b/app/services/idv/steps/welcome_step.rb index 4aea33ee396..53582e77f93 100644 --- a/app/services/idv/steps/welcome_step.rb +++ b/app/services/idv/steps/welcome_step.rb @@ -2,27 +2,12 @@ module Idv module Steps class WelcomeStep < DocAuthBaseStep def call - create_document_capture_session(document_capture_session_uuid_key) - end - - def form_submit return no_camera_redirect if params[:no_camera] - skip_to_capture if params[:skip_upload] - - Idv::ConsentForm.new.submit(consent_form_params) - end - - def consent_form_params - params.permit(:ial2_consent_given) + create_document_capture_session(document_capture_session_uuid_key) end private - def skip_to_capture - # See: Idv::DocAuthController#update_if_skipping_upload - flow_session[:skip_upload_step] = true - end - def no_camera_redirect redirect_to idv_doc_auth_errors_no_camera_url msg = 'Doc Auth error: Javascript could not detect camera on mobile device.' diff --git a/app/views/idv/doc_auth/agreement.html.erb b/app/views/idv/doc_auth/agreement.html.erb new file mode 100644 index 00000000000..f6a7ed7afec --- /dev/null +++ b/app/views/idv/doc_auth/agreement.html.erb @@ -0,0 +1,51 @@ +<% title t('titles.doc_auth.verify') %> + +<% if flow_session[:error_message] %> + <%= render 'shared/alert', { + type: 'error', + class: 'margin-bottom-4', + message: flow_session[:error_message], + } %> +<% end %> + +

<%= t('doc_auth.headings.lets_go') %>

+

<%= t('doc_auth.info.lets_go') %>

+

<%= t('doc_auth.headings.verify_identity') %>

+

<%= t('doc_auth.info.verify_identity') %>

+

<%= t('doc_auth.headings.secure_account') %>

+

<%= t('doc_auth.info.secure_account') %>

+ +<%= validated_form_for :doc_auth, + url: url_for, + method: 'put', + html: { autocomplete: 'off', role: 'form', class: 'margin-top-2 js-consent-continue-form' } do |f| %> +
+ + <%= f.button :button, t('doc_auth.buttons.continue'), type: :submit, + class: 'btn btn-primary btn-wide sm-col-6 col-6' %> +<% end %> + +
+ + +<% if user_fully_authenticated? %> + <%= render 'shared/cancel', link: idv_cancel_path %> +<% else %> +
+ <%= link_to(t('two_factor_authentication.choose_another_option'), two_factor_options_path) %> +
+<% end %> + + +<%= javascript_packs_tag_once( + 'clipboard', + 'ial2-consent-button', + 'document-capture-welcome', +) %> diff --git a/app/views/idv/doc_auth/overview.html.erb b/app/views/idv/doc_auth/overview.html.erb index 7e6e467bed9..0de51c8a199 100644 --- a/app/views/idv/doc_auth/overview.html.erb +++ b/app/views/idv/doc_auth/overview.html.erb @@ -65,7 +65,8 @@ <%= check_box_tag :ial2_consent_given, true, false %> <%= t('recover.instructions.consent') %> - <%= new_window_link_to(t('recover.instructions.learn_more'), 'https://login.gov/policy/') %> + <%= new_window_link_to(t('recover.instructions.learn_more'), + MarketingSite.security_and_privacy_practices_url) %> <%= f.button :submit, t('recover.buttons.continue'), class: 'btn btn-primary btn-wide sm-col-6 col-6' %> diff --git a/app/views/idv/doc_auth/welcome.html.erb b/app/views/idv/doc_auth/welcome.html.erb index bd4a478c32f..19778ba76ed 100644 --- a/app/views/idv/doc_auth/welcome.html.erb +++ b/app/views/idv/doc_auth/welcome.html.erb @@ -1,107 +1,86 @@ <% title t('titles.doc_auth.verify') %> <% step = 0 %> -<% if flow_session[:error_message] %> - <%= render 'shared/alert', { - type: 'error', - class: 'margin-bottom-4', - message: flow_session[:error_message], - } %> -<% end %> <%= render 'shared/maintenance_window_alert' do %> -

<%= t('doc_auth.headings.welcome') %>

-

<%= t('doc_auth.info.welcome') %>

-

<%= t('doc_auth.instructions.welcome') %>

+

<%= t('doc_auth.headings.welcome') %>

+

<%= t('doc_auth.info.welcome_html') %>

+

<%= t('doc_auth.instructions.welcome') %>

+

<%= t('doc_auth.instructions.privacy') %>

+

<%== t('doc_auth.info.privacy_html', link: new_window_link_to(t('doc_auth.instructions.learn_more'), + MarketingSite.security_and_privacy_practices_url)) %>

+ <%= validated_form_for :doc_auth, url: url_for, method: 'put', html: { autocomplete: 'off', role: 'form', class: 'margin-top-2 js-consent-continue-form' } do |f| %>
- <%= f.button :button, t('doc_auth.buttons.continue'), type: :submit, class: 'btn btn-primary btn-wide sm-col-6 col-6' %> <% end %> @@ -117,10 +96,6 @@ <% end %> - - <%= javascript_packs_tag_once( - 'clipboard', - 'ial2-consent-button', - 'document-capture-welcome', - ) %> <% end %> + +<%= javascript_packs_tag_once('document-capture-welcome') %> diff --git a/config/locales/doc_auth/en.yml b/config/locales/doc_auth/en.yml index ff10467f378..f5df8e306d3 100644 --- a/config/locales/doc_auth/en.yml +++ b/config/locales/doc_auth/en.yml @@ -90,8 +90,10 @@ en: document_capture_selfie: Your photo front: Front interstitial: We are processing your images + lets_go: Let's get started photo: Photo review_issues: Check your images and try again + secure_account: Secure your account selfie: Take a photo of yourself ssn: Please enter your social security number. take_picture: Take a photo with a phone @@ -102,7 +104,8 @@ en: a photo of yourself upload_liveness_enabled: How would you like to verify your identity? verify: Please verify your information - welcome: We need to verify your identity + verify_identity: Verify your identity + welcome: Verify your identity to securely access government services info: camera_required: Your mobile phone must have a camera and a web browser capture_status_capturing: Capturing @@ -122,6 +125,7 @@ en: when it’s done. interstitial_thanks: Thanks for your patience! keep_window_open: Do not close this window. + lets_go: 'Identity verification happens in two parts:' link_sent: Please check your phone and follow instructions to take a photo of your state issued ID. link_sent_complete_js: The next step will load automatically once you verify @@ -130,6 +134,12 @@ en: your identity. no_other_id_help_bold_html: "If you do not have a state-issued ID, get help at %{sp_name}." + privacy_html: Login.gov is a secure, government website that adheres to the + highest standards in data protection. We only use your data to verify your + identity. %{link} about our privacy and security measures. + secure_account: After you verify, we'll ask you to encrypt your account. Encryption + means your data is protected and only you, the account holder, will be able + to access or change your information. tag: Recommended take_picture: Use the camera on your mobile phone and upload images of your ID. We only use the images to verify your identity. @@ -146,16 +156,17 @@ en: identity. use_cac: Do you have a government employee ID? use_cac_link: Use a PIV/CAC instead + verify_identity: We'll ask for your personal information. We'll use, keep and + share some of your personal information to verify your identity against public + records. verifying: Verifying… - welcome: We verify your identity to make sure you are you—not someone pretending - to be you. Verifying your identity lets you access services that handle sensitive - information. + welcome_html: The agency that you are trying to access needs to make sure you + are you — not someone pretending to be you. instructions: - bullet1: Upload your ID - bullet1a: Take a photo of yourself - bullet2: Confirm your address - bullet3: Secure your account - bullet4: Account recovery + bullet1: Your State-issued ID + bullet1a: A device with a camera + bullet2: Your Social Security number + bullet3: A phone number on a phone plan associated with your name consent: By checking this box, you are letting login.gov ask for, use, keep, and share your personal information. We will only use it to verify your identity. document_capture_selfie_consent_action: "Allow access to the camera @@ -173,15 +184,17 @@ en: email_sent: Link sent to %{email}. Please check your desktop email and follow instructions to verify your identity. learn_more: Learn more + privacy: Our privacy and security standards send_sms: We'll send a text message to your device with a link. Follow that link to your browser to take photos of the front and back of your ID. switch_back: Switch back to your computer to finish verifying your identity - text1: along with your Social Security Number - text1a: with your phone or webcam - text2: using a phone number or mailing address - text3: by re-entering your login.gov password - text4: make sure you always have access - welcome: 'What you''ll need to do:' + text1: '' + text1a: such as a phone or computer. + text2: You will not need the card with you. + text3: You do not need to be the primary account holder. If you do not have + a phone number that qualifies, we can send you the verification code by mail + in approximately 3-7 business days. + welcome: 'To verify your identity, you will need:' tips: document_capture_header_text: 'For best results:' document_capture_hint: Must be a JPG, BMP, PNG, or TIFF diff --git a/config/locales/doc_auth/es.yml b/config/locales/doc_auth/es.yml index 70f9a7729dd..b0acb633965 100644 --- a/config/locales/doc_auth/es.yml +++ b/config/locales/doc_auth/es.yml @@ -97,8 +97,10 @@ es: document_capture_selfie: Su foto front: Parte Delantera interstitial: Estamos procesando sus imágenes + lets_go: Comencemos photo: Foto review_issues: Revise sus imágenes e inténtelo de nuevo + secure_account: Asegure su cuenta selfie: Tómese una foto ssn: Por favor ingrese su número de seguro social. take_picture: Toma una foto con un teléfono @@ -109,7 +111,9 @@ es: de identidad y tomarse upload_liveness_enabled: "¿Cómo te gustaría verificar su identidad?" verify: Por favor verifica tu información - welcome: Nosotros necesitamos verificar tu identidad + verify_identity: Verifique su identidad + welcome: Verifique su identidad para acceder de forma segura a los servicios + gubernamentales info: camera_required: Su teléfono móvil debe tener una cámara y un navegador web capture_status_capturing: Capturando @@ -130,6 +134,7 @@ es: paso automáticamente cuando esté terminado. interstitial_thanks: "¡Gracias por su paciencia!" keep_window_open: No cierres esta ventana. + lets_go: 'La verificación de la identidad se realiza en dos partes:' link_sent: Verifique su teléfono y siga las instrucciones para tomar una fotografía de la identificación emitida por su estado. link_sent_complete_js: El siguiente paso se cargará automáticamente una vez @@ -138,6 +143,13 @@ es: la verificación de tu identidad. no_other_id_help_bold_html: "Si no tiene un documento de identidad expedido por el estado, obtenga ayuda en %{sp_name}." + privacy_html: Login.gov es un sitio web gubernamental seguro que cumple con + las normas más estrictas de protección de datos. Solo utilizamos sus datos + para verificar su identidad. %{link} sobre nuestras medidas de privacidad + y seguridad. + secure_account: Una vez que haya verificado su identidad, le pediremos que cifre + su cuenta. Con el cifrado, sus datos quedan protegidos, por lo que solo usted, + el titular de la cuenta, puede acceder a su información o modificarla. tag: Recomendado take_picture: Use la cámara en su teléfono móvil y cargue imágenes de su identificación. Solo usamos las imágenes para verificar su identidad. @@ -156,18 +168,19 @@ es: su identidad. use_cac: "¿Tiene un documento de identidad de empleado del gobierno?" use_cac_link: Utilice un PIV/CAC en su lugar + verify_identity: Le pediremos su información personal. Utilizaremos, conservaremos + y compartiremos algunos de sus datos personales para verificar su identidad + con los registros públicos. verifying: Verificando… - welcome: Verificamos su identidad para asegurarnos de que usted es usted, y - no alguien que pretende ser usted. Verificar su identidad le permite acceder - a servicios que manejan información confidencial. + welcome_html: La agencia a la que está intentando acceder debe asegurarse de + que usted sea quien dice ser, y no alguien que se hace pasar por usted. instructions: - bullet1: Sube tu ID - bullet1a: Tómese una foto - bullet2: Confirma tu direccion - bullet3: Asegure su cuenta - bullet4: Recuperación de cuenta - consent: Al marcar esta casilla, está permitiendo que login.gov solicite, use, - conserve y comparta su información personal. Solo lo usaremos para verificar + bullet1: Su documento de identidad emitido por el estado. + bullet1a: Un dispositivo con cámara + bullet2: Su Número de Seguridad Social. + bullet3: Un número de teléfono con un plan tarifario vinculado a su nombre. + consent: Al marcar esta casilla, usted permite que login.gov solicite, utilice, + conserve y comparta su información personal. Solo la utilizaremos para verificar su identidad. document_capture_selfie_consent_action: "Permita el acceso a la cámara y busque una notificación en su navegador o revise la @@ -183,17 +196,19 @@ es: con la imagen en el frente de su identificación. email_sent: Enlace enviado a %{email}. Compruebe el correo electrónico de su escritorio y siga las instrucciones para verificar su identidad. - learn_more: Aprende más + learn_more: Obtenga más información + privacy: Nuestras normas de privacidad y seguridad send_sms: Le enviaremos un mensaje de texto a su dispositivo con un enlace. Siga ese enlace a su navegador para tomar fotografías de la parte delantera y trasera de su identificación. switch_back: Vuelve a tu computadora para terminar de verificar tu identidad - text1: junto con su número de seguro social - text1a: con un teléfono o cámara web - text2: usando un número de teléfono o dirección de correo - text3: volviendo a ingresar su contraseña de login.gov - text4: asegúrate de tener siempre acceso - welcome: 'Lo que necesitarás hacer:' + text1: '' + text1a: como un teléfono o una computadora. + text2: No es necesario disponer de la credencial. + text3: No es necesario que sea el titular principal de la cuenta. Si no tiene + un número de teléfono que cumpla con este requisito, podemos enviarle el código + de verificación por correo en un plazo aproximado de 3 a 7 días laborables. + welcome: 'Deberá contar con lo siguiente para verificar su identidad:' tips: document_capture_header_text: 'Para obtener los mejores resultados:' document_capture_hint: Debe ser un JPG, BMP, PNG o TIFF diff --git a/config/locales/doc_auth/fr.yml b/config/locales/doc_auth/fr.yml index f52084a0440..ea27aba31ac 100644 --- a/config/locales/doc_auth/fr.yml +++ b/config/locales/doc_auth/fr.yml @@ -105,8 +105,10 @@ fr: document_capture_selfie: Votre photo front: Recto interstitial: Nous traitons vos images + lets_go: Commençons photo: Photo review_issues: Vérifiez vos images et essayez à nouveau + secure_account: Sécuriser votre compte selfie: Prenez une photo de vous-même ssn: S'il vous plaît entrez votre numéro de sécurité sociale. take_picture: Prendre une photo avec un téléphone @@ -119,7 +121,9 @@ fr: votre pièce d'identité et prendre une photo de vous-même upload_liveness_enabled: Comment souhaitez-vous vérifier votre identité? verify: S'il vous plaît vérifier vos informations - welcome: Nous devons vérifier votre identité + verify_identity: Vérifier votre identité + welcome: Vérifiez votre identité pour accéder en toute sécurité aux services + gouvernementaux info: camera_required: Votre téléphone portable doit avoir une caméra et un navigateur Web @@ -141,6 +145,7 @@ fr: automatiquement l'étape suivante lorsqu'elle sera terminée. interstitial_thanks: Merci de votre patience! keep_window_open: Ne fermez pas cette fenêtre. + lets_go: La vérification de l'identité se fait en deux temps link_sent: Veuillez vérifier votre téléphone et suivre les instructions pour prendre une photo de votre identité émise par l'État. link_sent_complete_js: L'étape suivante se chargera automatiquement une fois @@ -150,6 +155,14 @@ fr: no_other_id_help_bold_html: "Si vous n'avez pas de carte d'identité délivrée par l'État, obtenez de l'aide à l'adresse %{sp_name}." + privacy_html: Login.gov est un site gouvernemental sécurisé qui respecte les + normes les plus strictes en matière de protection des données. Nous n'utilisons + vos données uniquement pour vérifier votre identité. %{link} sur nos mesures + de confidentialité et de sécurité. + secure_account: Après avoir vérifié votre identité, nous vous demanderons de + crypter votre compte. Le cryptage garantit la protection de vos données et + seul vous, le titulaire du compte, pourrez accéder à vos informations ou les + modifier. tag: Recommandation take_picture: Utilisez l'appareil photo sur votre téléphone portable et téléchargez des images de votre identifiant. Nous utilisons uniquement les images pour @@ -170,18 +183,19 @@ fr: upload_no_image_storage: Nous ne stockons pas les images que vous téléchargez. use_cac: Avez-vous une carte d'identité d'employé du gouvernement? use_cac_link: Utilisez plutôt une PIV/CAC + verify_identity: Nous vous demanderons vos renseignements personnels. Nous utiliserons, + conserverons et partagerons certains de vos renseignements personnels pour + vérifier votre identité par rapport aux registres publics. verifying: Vérification… - welcome: Nous vérifions votre identité pour nous assurer que vous êtes bien, - et non quelqu'un prétendant être vous. La vérification de votre identité vous - permet d'accéder à des services traitant des informations sensibles. + welcome_html: L'agence à laquelle vous essayez d'accéder doit s'assurer qu'il + s'agit bien de vous, et non de quelqu'un qui se fait passer pour vous. instructions: - bullet1: Téléchargez votre identifiant - bullet1a: Prenez une photo de vous-même - bullet2: Confirmez votre adresse - bullet3: Sécurise ton compte - bullet4: Récupération du compte + bullet1: Votre carte d'identité émise par l'État + bullet1a: Un appareil équipé d'une caméra + bullet2: Votre numéro de sécurité sociale + bullet3: Un numéro de téléphone associé à un forfait téléphonique à votre nom consent: En cochant cette case, vous autorisez login.gov à demander, utiliser, - conserver et partager vos informations personnelles. Nous ne l'utiliserons + conserver et partager vos renseignements personnels. Nous ne les utiliserons que pour vérifier votre identité. document_capture_selfie_consent_action: "Autorisez l'accès à la caméra et recherchez une notification dans votre navigateur @@ -198,18 +212,21 @@ fr: Nous le comparerons à l'image au recto de votre pièce d'identité. email_sent: Lien envoyé à %{email}. Veuillez vérifier votre email de bureau et suivez les instructions pour vérifier votre identité. - learn_more: Apprendre encore plus + learn_more: En savoir plus + privacy: Nos normes de confidentialité et de sécurité send_sms: Nous enverrons un message texte à votre appareil avec un lien. Suivez ce lien vers votre navigateur pour prendre des photos du recto et du verso de votre identifiant. switch_back: Revenez sur votre ordinateur pour terminer la vérification de votre identité - text1: avec votre numéro de sécurité sociale - text1a: avec votre téléphone ou votre caméra Web - text2: en utilisant un numéro de téléphone ou une adresse postale - text3: en ressaisissant votre mot de passe login.gov - text4: assurez-vous d'avoir toujours accès - welcome: 'Ce que vous devez faire:' + text1: '' + text1a: tel qu'un téléphone ou un ordinateur + text2: Vous n'aurez pas besoin de la carte avec vous. + text3: Il n'est pas nécessaire que vous soyez le titulaire principal de la ligne. + Si votre numéro de téléphone ne remplit pas les conditions requises, nous + pouvons vous envoyer le code de vérification par courrier dans un délai de + 3 à 7 jours ouvrables. + welcome: 'Pour vérifier votre identité, vous aurez besoin de:' tips: document_capture_header_text: 'Pour obtenir les meilleurs résultats:' document_capture_hint: Doit être un JPG, BMP, PNG ou TIFF diff --git a/db/migrate/20210316082419_add_agreement_steps_to_doc_auth_logs.rb b/db/migrate/20210316082419_add_agreement_steps_to_doc_auth_logs.rb new file mode 100644 index 00000000000..d0a4945d448 --- /dev/null +++ b/db/migrate/20210316082419_add_agreement_steps_to_doc_auth_logs.rb @@ -0,0 +1,8 @@ +class AddAgreementStepsToDocAuthLogs < ActiveRecord::Migration[5.1] + def change + safety_assured do + add_column :doc_auth_logs, :agreement_view_at, :datetime + add_column :doc_auth_logs, :agreement_view_count, :integer, default: 0 + end + end +end diff --git a/db/schema.rb b/db/schema.rb index 3bca0fea0ce..caa1f6aad3f 100644 --- a/db/schema.rb +++ b/db/schema.rb @@ -10,7 +10,7 @@ # # It's strongly recommended that you check this file into your version control system. -ActiveRecord::Schema.define(version: 2021_03_15_144559) do +ActiveRecord::Schema.define(version: 2021_03_16_082419) do # These are extensions that must be enabled in order to support this database enable_extension "plpgsql" @@ -189,6 +189,8 @@ t.integer "document_capture_view_count", default: 0 t.integer "document_capture_submit_count", default: 0 t.integer "document_capture_error_count", default: 0 + t.datetime "agreement_view_at" + t.integer "agreement_view_count", default: 0 t.index ["user_id"], name: "index_doc_auth_logs_on_user_id", unique: true t.index ["verified_view_at"], name: "index_doc_auth_logs_on_verified_view_at" end diff --git a/spec/controllers/idv/doc_auth_controller_spec.rb b/spec/controllers/idv/doc_auth_controller_spec.rb index 4f4ea1267d6..e9fef3b7726 100644 --- a/spec/controllers/idv/doc_auth_controller_spec.rb +++ b/spec/controllers/idv/doc_auth_controller_spec.rb @@ -145,12 +145,6 @@ ) end - it 'progresses from welcome to upload' do - put :update, params: { step: 'welcome', ial2_consent_given: true } - - expect(response).to redirect_to idv_doc_auth_step_url(step: :upload) - end - it 'redirects from welcome to no camera error' do result = { success: false, diff --git a/spec/features/idv/doc_auth/agreement_step_spec.rb b/spec/features/idv/doc_auth/agreement_step_spec.rb new file mode 100644 index 00000000000..6b2f4fcd243 --- /dev/null +++ b/spec/features/idv/doc_auth/agreement_step_spec.rb @@ -0,0 +1,99 @@ +require 'rails_helper' + +feature 'doc auth welcome step' do + include DocAuthHelper + + def expect_doc_auth_upload_step + expect(page).to have_current_path(idv_doc_auth_upload_step) + end + + context 'button is disabled when JS is enabled', :js do + before do + sign_in_and_2fa_user + complete_doc_auth_steps_before_agreement_step + end + + it_behaves_like 'ial2 consent with js' + end + + context 'button is clickable when JS is disabled' do + before do + sign_in_and_2fa_user + complete_doc_auth_steps_before_agreement_step + end + + def expect_doc_auth_first_step + expect(page).to have_current_path(idv_doc_auth_agreement_step) + end + + it_behaves_like 'ial2 consent without js' + end + + context 'skipping upload step', :js, driver: :headless_chrome_mobile do + let(:fake_analytics) { FakeAnalytics.new } + + before do + allow_any_instance_of(ApplicationController). + to receive(:analytics).and_return(fake_analytics) + + sign_in_and_2fa_user + complete_doc_auth_steps_before_agreement_step + find('label', text: /^By checking this box/).click + click_continue + end + + it 'progresses to document capture' do + expect(page).to have_current_path(idv_doc_auth_document_capture_step) + end + + it 'logs analytics for upload step' do + log = DocAuthLog.last + expect(log.upload_view_count).to eq 1 + expect(log.upload_view_at).not_to be_nil + + expect(fake_analytics).to have_logged_event( + Analytics::DOC_AUTH + ' visited', step: 'upload', step_count: 1 + ) + expect(fake_analytics).to have_logged_event( + Analytics::DOC_AUTH + ' submitted', step: 'upload', step_count: 2, success: true + ) + expect(fake_analytics).to have_logged_event( + 'IdV: ' + "#{Analytics::DOC_AUTH} upload visited".downcase, step: 'upload', step_count: 1 + ) + expect(fake_analytics).to have_logged_event( + 'IdV: ' + "#{Analytics::DOC_AUTH} upload submitted".downcase, + step: 'upload', step_count: 2, success: true, + ) + + end + end + + context 'during the acuant maintenance window' do + context 'during the acuant maintenance window' do + let(:start) { Time.zone.parse('2020-01-01T00:00:00Z') } + let(:now) { Time.zone.parse('2020-01-01T12:00:00Z') } + let(:finish) { Time.zone.parse('2020-01-01T23:59:59Z') } + + before do + allow(AppConfig.env).to receive(:acuant_maintenance_window_start).and_return( + start.iso8601, + ) + allow(AppConfig.env).to receive(:acuant_maintenance_window_finish).and_return( + finish.iso8601, + ) + + sign_in_and_2fa_user + complete_doc_auth_steps_before_welcome_step + end + + around do |ex| + Timecop.travel(now) { ex.run } + end + + it 'renders the warning banner but no other content' do + expect(page).to have_content('We are currently under maintenance') + expect(page).to_not have_content(t('doc_auth.headings.welcome')) + end + end + end +end diff --git a/spec/features/idv/doc_auth/welcome_step_spec.rb b/spec/features/idv/doc_auth/welcome_step_spec.rb index b3f6a3613c8..95cee8bcddb 100644 --- a/spec/features/idv/doc_auth/welcome_step_spec.rb +++ b/spec/features/idv/doc_auth/welcome_step_spec.rb @@ -7,28 +7,6 @@ def expect_doc_auth_upload_step expect(page).to have_current_path(idv_doc_auth_upload_step) end - context 'button is disabled when JS is enabled', :js do - before do - sign_in_and_2fa_user - complete_doc_auth_steps_before_welcome_step - end - - it_behaves_like 'ial2 consent with js' - end - - context 'button is clickable when JS is disabled' do - before do - sign_in_and_2fa_user - complete_doc_auth_steps_before_welcome_step - end - - def expect_doc_auth_first_step - expect(page).to have_current_path(idv_doc_auth_welcome_step) - end - - it_behaves_like 'ial2 consent without js' - end - context 'skipping upload step', :js, driver: :headless_chrome_mobile do let(:fake_analytics) { FakeAnalytics.new } @@ -38,33 +16,11 @@ def expect_doc_auth_first_step sign_in_and_2fa_user complete_doc_auth_steps_before_welcome_step - find('label', text: /^By checking this box/).click click_continue end - it 'progresses to document capture' do - expect(page).to have_current_path(idv_doc_auth_document_capture_step) - end - - it 'logs analytics for upload step' do - log = DocAuthLog.last - expect(log.upload_view_count).to eq 1 - expect(log.upload_view_at).not_to be_nil - - expect(fake_analytics).to have_logged_event( - Analytics::DOC_AUTH + ' visited', step: 'upload', step_count: 1 - ) - expect(fake_analytics).to have_logged_event( - Analytics::DOC_AUTH + ' submitted', step: 'upload', step_count: 2, success: true - ) - expect(fake_analytics).to have_logged_event( - 'IdV: ' + "#{Analytics::DOC_AUTH} upload visited".downcase, step: 'upload', step_count: 1 - ) - expect(fake_analytics).to have_logged_event( - 'IdV: ' + "#{Analytics::DOC_AUTH} upload submitted".downcase, - step: 'upload', step_count: 2, success: true, - ) - + it 'progresses to the agreement screen' do + expect(page).to have_current_path(idv_doc_auth_agreement_step) end end diff --git a/spec/features/reports/doc_auth_funnel_report_spec.rb b/spec/features/reports/doc_auth_funnel_report_spec.rb index db4733f2cb0..7b7a971d908 100644 --- a/spec/features/reports/doc_auth_funnel_report_spec.rb +++ b/spec/features/reports/doc_auth_funnel_report_spec.rb @@ -88,6 +88,8 @@ 'verify_view_percent' => 100.0, 'welcome_view_count_average' => 1.0, 'welcome_view_percent' => 100.0, + 'agreement_view_count_average' => 1.0, + 'agreement_view_percent' => 100.0, } end diff --git a/spec/support/features/doc_auth_helper.rb b/spec/support/features/doc_auth_helper.rb index ed878e263e8..25f60395269 100644 --- a/spec/support/features/doc_auth_helper.rb +++ b/spec/support/features/doc_auth_helper.rb @@ -42,6 +42,10 @@ def idv_doc_auth_welcome_step idv_doc_auth_step_path(step: :welcome) end + def idv_doc_auth_agreement_step + idv_doc_auth_step_path(step: :agreement) + end + def idv_doc_auth_upload_step idv_doc_auth_step_path(step: :upload) end @@ -75,8 +79,14 @@ def complete_doc_auth_steps_before_welcome_step(expect_accessible: false) expect(page).to be_accessible.according_to :section508, :"best-practice" if expect_accessible end + def complete_doc_auth_steps_before_agreement_step(expect_accessible: false) + complete_doc_auth_steps_before_welcome_step(expect_accessible: expect_accessible) + click_on t('doc_auth.buttons.continue') + end + def complete_doc_auth_steps_before_upload_step(expect_accessible: false) complete_doc_auth_steps_before_welcome_step(expect_accessible: expect_accessible) + click_on t('doc_auth.buttons.continue') find('label', text: t('doc_auth.instructions.consent')).click click_on t('doc_auth.buttons.continue') end diff --git a/spec/support/monitor/monitor_idv_steps.rb b/spec/support/monitor/monitor_idv_steps.rb index 575a79e7f9e..e0730363a3f 100644 --- a/spec/support/monitor/monitor_idv_steps.rb +++ b/spec/support/monitor/monitor_idv_steps.rb @@ -6,7 +6,9 @@ def verify_identity_with_doc_auth click_on 'Create an account' create_new_account_with_sms expect(page).to have_current_path('/verify/doc_auth/welcome') + click_on 'Continue' + expect(page).to have_current_path('/verify/doc_auth/agreement') check 'ial2_consent_given', visible: :all, allow_label_click: true expect(page).to have_button('Continue', disabled: :all)