Skip to content

LG-12067 TMX Integration Specs#10231

Merged
JackRyan1989 merged 25 commits intomainfrom
jryan/lg-12067-ipp-tmx-integration-tests
Mar 19, 2024
Merged

LG-12067 TMX Integration Specs#10231
JackRyan1989 merged 25 commits intomainfrom
jryan/lg-12067-ipp-tmx-integration-tests

Conversation

@JackRyan1989
Copy link
Contributor

🎫 Ticket

Link to the relevant ticket:
LG-12067

🛠 Summary of changes

Lots of specs written.

To do:

  1. Confirm that all testing conditions outlined in this document are met (I think they are but they need to be double checked)
  2. Add a changelog
  3. Integrate @n1zyy's changes from Bugfix: Clear in_person_verification_pending_at on fraud deactivation #10222 and get the specs all green again.
  4. Re Set up Code Climate #4 - two specs are failing for me when I add in this change: the cancellation spec starting on line 252 of in_person_threatmetrix_spec and the IPP fail and TMX fail spec starting on line 234. See if you can replicate these failures and then fix. There's a third test that's failing as well but I think that one is chromedriver based. Not sure though.

📜 Testing Plan

Get the specs to pass

update(in_person_proofing_enabled: true)
end

def deactivate_profile_update_enrollment(status:)
Copy link
Contributor Author

Choose a reason for hiding this comment

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

So in thinking about this a bit more, this maybe isn't the best idea. I'm obscuring some important things that happen in the flow, and are basically stand-ins for the get_usps_proofing_job. Not sure what the best approach here is. I suppose this can be unwound so that the deactivation and updates are more explicit in the spec, or this thing can be moved to the in_person_helper if that is a more appropriate place for this sort of method.

Copy link
Contributor

Choose a reason for hiding this comment

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

i do like the idea of moving this function out of the file...maybe to a threatmetrix_helper file? though the in_person_helper is also a good place

Copy link
Contributor

Choose a reason for hiding this comment

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

I keep going back and forth on the best approach here. I have two somewhat contradictory opinions:

  1. Too many of our tests are really redundant, repeating with just a few changes like 20 lines of setup for each case, that could really be factored out. Beyond some ideas about cleanliness, I think this would make it easier to reason about what was happening.
  2. Some of our tests take shortcuts with setup that aren't consistent with what happens "in the real world," and occasionally this masks issues.

So I like this approach for helping with #1. For #2, I wonder if you could actually call GetUspsProofingResultsJob live here?

But, I also think this is an improvement as-is and am on board with :shipit: your improved, expanded test coverage and potentially coming back later to polish it a bit more.

Copy link
Contributor

Choose a reason for hiding this comment

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

those are great points. as for using that job I believe we could do that here. I'll try to update it

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 encountering an error related to usermailer when I try to include GetUspsProofingResultsJob. I wonder if that's why we're updating the enrollment as we are here, to get around the mailer issue?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@svalexander that's exactly why I went with directly updating the enrollment.

end

def complete_ssn_step(_user = nil)
def complete_ssn_step(_user = nil, tmx_status = nil)
Copy link
Contributor Author

Choose a reason for hiding this comment

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

added this arg to help toggle the tmx_status. However, we don't always toggle the value, hence the default nil.

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 a great addition

complete_verify_step(user)
end

def complete_entire_ipp_flow(user = user_with_2fa, tmx_status = nil, same_address_as_id: true)
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Decided to make a helper method for the entire flow from sign in to personal key acknowledgement. I don't think I'm duplicating work here?

Copy link
Contributor

Choose a reason for hiding this comment

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

from what i can see that seems accurate. good addition to have

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 biased, but I like this approach. It DRYs up a lot.

# update the enrollment:
enrollment.update(
status: status,
proofed_at: Time.zone.now,
Copy link
Contributor Author

Choose a reason for hiding this comment

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

The proofed_at and status_check_completed_at values are never checked. So I suppose we could remove them, but I wanted to more closely emulate how the enrollment gets updated.

allow(IdentityConfig.store).to receive(:in_person_proofing_enabled).and_return(true)
end

context 'ThreatMetrix review pending' do
Copy link
Contributor Author

@JackRyan1989 JackRyan1989 Mar 12, 2024

Choose a reason for hiding this comment

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

Moved the TMX related specs to in_person_threatmetrix_spec.rb

@svalexander svalexander marked this pull request as ready for review March 14, 2024 17:00
# user can restart
click_on t('idv.cancel.actions.start_over')

expect(page).to have_current_path(idv_welcome_path)
Copy link
Contributor

Choose a reason for hiding this comment

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

this now fails after the merge of the recent bug fix. The before action confirm_fraud_pending in the please_call_controller is not redirecting as fraud_review_pending? is true. (though that method would redirect us to the account page and not the welcome page)

end
end

# To be completed in a future ticket
Copy link
Contributor

Choose a reason for hiding this comment

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

Ticket added to address these 2 commented out specs

Copy link
Contributor

@n1zyy n1zyy left a comment

Choose a reason for hiding this comment

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

Nice work here, both @JackRyan1989 for laying an excellent foundation that exposed some bugs, and @svalexander for picking it up and running with it (and also catching bugs 🥲).

Please remove WIP from the PR title before merging, but I'm really happy with where this ended up. All that remains is rubocop yelling that a commented-out line is now one character too long.

update(in_person_proofing_enabled: true)
end

def deactivate_profile_update_enrollment(status:)
Copy link
Contributor

Choose a reason for hiding this comment

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

I keep going back and forth on the best approach here. I have two somewhat contradictory opinions:

  1. Too many of our tests are really redundant, repeating with just a few changes like 20 lines of setup for each case, that could really be factored out. Beyond some ideas about cleanliness, I think this would make it easier to reason about what was happening.
  2. Some of our tests take shortcuts with setup that aren't consistent with what happens "in the real world," and occasionally this masks issues.

So I like this approach for helping with #1. For #2, I wonder if you could actually call GetUspsProofingResultsJob live here?

But, I also think this is an improvement as-is and am on board with :shipit: your improved, expanded test coverage and potentially coming back later to polish it a bit more.

expect_in_person_step_indicator_current_step(
t('step_indicator.flows.idv.go_to_the_post_office'),
)
expect(page).to have_content(t('in_person_proofing.headings.barcode').tr(' ', ' '))
Copy link
Contributor

Choose a reason for hiding this comment

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

Not for this PR, especially because this was just moved around (and I think I may have written the original line I'm now objecting to 😆), but I wonder if we can move the .tr(' ', ' ')) pattern into a helper method explaining what the heck it's doing later on. It's not at all intuitive that these are two different strings (replacing a non-breaking space with a regular space, or vice versa).

But again, not for now. I'll file a ticket.

Copy link
Contributor

Choose a reason for hiding this comment

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

LG-12736 created for this.

@svalexander svalexander changed the title WIP LG-12067 TMX Integration Specs LG-12067 TMX Integration Specs Mar 18, 2024
@JackRyan1989 JackRyan1989 self-assigned this Mar 19, 2024
@JackRyan1989 JackRyan1989 merged commit 77148e9 into main Mar 19, 2024
@JackRyan1989 JackRyan1989 deleted the jryan/lg-12067-ipp-tmx-integration-tests branch March 19, 2024 14:11
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.

3 participants