Skip to content

LG-9072 Applicant verify your information page "update state ID" workflows #8288

Merged
gina-yamada merged 26 commits intomainfrom
gina/lg-9072-applicant-update-workflows
May 2, 2023
Merged

LG-9072 Applicant verify your information page "update state ID" workflows #8288
gina-yamada merged 26 commits intomainfrom
gina/lg-9072-applicant-update-workflows

Conversation

@gina-yamada
Copy link
Contributor

@gina-yamada gina-yamada commented Apr 26, 2023

🎫 Ticket

LG-9072 Applicant verify your information page "update state ID" workflows

🛠 Summary of changes

I am making workflow updates only after the Verify your info page (only behind the in_person_capture_secondary_id_enabled feature flag) to capture different scenarios/flows a user might encounter related to state id address and their current residential address when a user selects Update on Verify your information for State-issued ID.

📜 Testing Plan

  • Step 1: Set env variable in_person_capture_secondary_id_enabled to true to test the following.
  • Step 1A: Test Scenario 1 Given a user who changes their indication from current address IS NOT LISTED to IS LISTED (“No” to “Yes”)
1. Route user to Update info on your state ID page
2. When user changes the radio options from "No" to "Yes" and clicks Update, route user back to the Verify Info page. (Make some updates to state ID inputs before clicking Update.)
3. Show the state ID address for the residential address
4. If any additional changes were made to the State ID page, they should be reflected on the Verify Info page
  • Step 1B: Test Scenario 2 Given a user who changes their indication from IS LISTED to IS NOT LISTED (“Yes” to “No”)
1. Route user to Update info on your state ID page
2. When user changes the radio options from "Yes" to "No" and clicks Update, route the user to a blank Enter your current residential address page. (Make some updates to state ID inputs before clicking Update too.)
3. When user clicks Continue, route user back to the Verify Info page (skip SSN page)
4. Show updates to residential address
  • Step 1C Test Scenario 4: Given a user updates state ID page and DOES NOT change the radio options (this should be current behavior)
1. Route user to Update info your state ID page
2. When a user clicks Update, route user back to Verify info page and show their updates in the State ID section 
  • Step 2: Set env variable in_person_capture_secondary_id_enabled to false and ensure the existing flows have not been affected. (I compared my branch to main with in_person_capture_secondary_id_enabled to false. I did not notice any difference.) Please confirm/test this out as well.

👀 Screenshots

You will need to walk through the flow to test this out so no screenshots

@gina-yamada gina-yamada marked this pull request as draft April 26, 2023 16:14
@gina-yamada gina-yamada marked this pull request as ready for review April 27, 2023 21:10
@gina-yamada gina-yamada changed the title DRAFT LG-9072 Applicant verify your information page "update state ID" workflows LG-9072 Applicant verify your information page "update state ID" workflows Apr 27, 2023
@gina-yamada gina-yamada requested review from a team, NavaTim and tomas-nava April 27, 2023 21:25

describe '#updating_address effects on extra_view_variables.updating_address' do
let(:address1) { '123 Fourth St' }
let(:uuid) { '0000' }
Copy link
Contributor

Choose a reason for hiding this comment

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

we should delete this as it's not being used

end

describe '#updating_address effects on extra_view_variables.updating_address' do
let(:address1) { '123 Fourth St' }
Copy link
Contributor

@svalexander svalexander Apr 27, 2023

Choose a reason for hiding this comment

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

let's use the constant we have for address1 in this test: InPersonHelper::GOOD_ADDRESS1

let(:pii_from_user) { flow.flow_session[:pii_from_user] }
let(:params) { ActionController::Parameters.new({ state_id: submitted_values }) }
let(:capture_secondary_id_enabled) { true }
let(:dob) { '1972-02-23' }
Copy link
Contributor

Choose a reason for hiding this comment

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

for lines 247-260 lets use the constants in the in_person_helper file

and_return(enrollment)
end

# User picks "Yes, I live at the address on my state-issued ID"
Copy link
Contributor

Choose a reason for hiding this comment

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

can we break these comments up and put them in the test at the point were we're doing each behavior described?

@gina-yamada gina-yamada requested a review from svalexander April 28, 2023 14:53
Copy link
Contributor

@eileen-nava eileen-nava left a comment

Choose a reason for hiding this comment

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

I left some thoughts. Please feel free to ask follow-up questions. Thanks! 🙏🏻

end

if capture_secondary_id_enabled?
if (initial_state_of_same_address_as_id === 'true' &&
Copy link
Contributor

Choose a reason for hiding this comment

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

I'd suggest making this syntax more Rubyesque by

  • changing === to ==
  • removing the parentheses from the if statement on line 34

Right now, the syntax looks more like a JavaScript conditional statement.

Copy link
Contributor

Choose a reason for hiding this comment

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

I’m interested in ways to keep this conditional logic readable and maintainable. What would you think about a refactor that uses nesting and helper methods, like…..

          if capture_secondary_id_enabled?
            if pii_from_user[:same_address_as_id] == 'true'
              copy_state_id_address_to_residential_address(pii_from_user)
              mark_step_complete(:address)
            end

            if initial_state_of_same_address_as_id === 'true' &&
               pii_from_user[:same_address_as_id] === 'false'
              clear_residential_address(pii_from_user)
              mark_step_incomplete(:address)
            end
          end

And then the helper methods could be defined further down....

        private

        def copy_state_id_address_to_residential_address
          pii_from_user[:address1] = flow_params[:identity_doc_address1]
          pii_from_user[:address2] = flow_params[:identity_doc_address2]
          pii_from_user[:city] = flow_params[:identity_doc_city]
          pii_from_user[:state] = flow_params[:identity_doc_address_state]
          pii_from_user[:zipcode] = flow_params[:identity_doc_zipcode]
        end

        def clear_residential_address
          pii_from_user.delete(:address1)
          pii_from_user.delete(:address2)
          pii_from_user.delete(:city)
          pii_from_user.delete(:state)
          pii_from_user.delete(:zipcode)
        end

It might also be cute to have a one-liner method for flow_session[:pii_from_user][:same_address_as_id] == 'true', like state_id_address_and_residential_address_initially_same?. Although, yikes, that is a long method name! 😓 You could also make a method for initial_state_of_same_address_as_id == 'true' && pii_from_user[:same_address_as_id] == 'false', like state_id_address_and_address_diverge?. These are all suggestions and the method names are very rough draft. Let me know what you think! :)

end
end

describe '#updating_address effects on extra_view_variables.updating_address' do
Copy link
Contributor

Choose a reason for hiding this comment

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

What would you think about combining these specs with the existing #extra_view_variables describe block in this file?

end

before(:each) do
allow(IdentityConfig.store).to receive(:in_person_capture_secondary_id_enabled).
Copy link
Contributor

Choose a reason for hiding this comment

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

You can delete line 281. Lines 247 and 283 are sufficient setup.

end
end

describe '#call' do
Copy link
Contributor

Choose a reason for hiding this comment

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

What do you think about combining this with the other #call describe block in this spec? Or changing this line so that there aren't two describe blocks with the same name in one file?

@gina-yamada gina-yamada requested a review from eileen-nava May 1, 2023 16:35
Copy link
Contributor

Choose a reason for hiding this comment

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

I recommend additionally testing the following cases in this file.

  • :same_address_as_id field is not updated while DAV is enabled
  • :same_address_as_id is set from 'false' to 'true' while DAV is enabled

complete_prepare_step(user)
end

it 'but does not update their previous selection of "Yes,
Copy link
Contributor

Choose a reason for hiding this comment

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

This is super tiny, but can you remove the 'but' from start of the test names? I keep reading it as "it but does not" and I get confused.

)
end

it 'and updates their previous selection from "Yes" TO "No, I live at a different address"' do
Copy link
Contributor

Choose a reason for hiding this comment

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

Same with the 'ands'.

@gina-yamada gina-yamada requested a review from a team May 1, 2023 18:23
@gina-yamada
Copy link
Contributor Author

@18F/identity-joy-designers I did not take screenshots because it is really about the redirects here. I am happy to jump on a call and walk through each of the scenarios so that you can see the flow

@kellular kellular requested review from a team and kellular and removed request for a team and tomas-nava May 1, 2023 19:19
Copy link
Contributor

@eileen-nava eileen-nava left a comment

Choose a reason for hiding this comment

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

This looks good to me. That being said, I think Jack and Tim had good points about testing.

Copy link
Contributor

@JackRyan1989 JackRyan1989 left a comment

Choose a reason for hiding this comment

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

LGTM!

Copy link

@kellular kellular left a comment

Choose a reason for hiding this comment

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

Gina walked me through the scenarios in her local env. LGTM, thank you!

@gina-yamada gina-yamada merged commit 4886b29 into main May 2, 2023
@gina-yamada gina-yamada deleted the gina/lg-9072-applicant-update-workflows branch May 2, 2023 15:21
@mdiarra3 mdiarra3 mentioned this pull request May 4, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

6 participants