Skip to content

FlowPolicy spec helpers for idv_session setup#9714

Merged
soniaconnolly merged 7 commits intomainfrom
doug-lg-11463-spec-helpers
Dec 6, 2023
Merged

FlowPolicy spec helpers for idv_session setup#9714
soniaconnolly merged 7 commits intomainfrom
doug-lg-11463-spec-helpers

Conversation

@solipet
Copy link
Contributor

@solipet solipet commented Dec 5, 2023

🛠 Summary of changes

Introduces helpers in FlowPolicyHelper to set up the preconditions for idv steps in our specs. Note how much cleaner the flow_policy_spec setup is for all the individual step specs. We plan to use stub_up_to_key in the controller specs once this is merged.

Along the way, improved preconditions for PhoneStep and VerifyByMail.

📜 Testing Plan

  • Primarily spec change, so run specs
  • Create account, start IdV
  • At VerifyInfo step, try to jump to urls: /verify/phone, /verify/phone_confirmation, /verify/by_mail/request_letter, /verify/enter_password, /verify/personal_key
  • Expect to stay on VerifyInfo
  • Submit VerifyInfo, choose verify by mail, click RequestLetter
  • Use browser back and forward buttons to move in the flow
  • Resubmit VerifyInfo
  • Try to jump to urls:/verify/phone_confirmation, /verify/enter_password, /verify/personal_key
  • Expect to stay on Phone step
  • Submit Phone step
  • Try to jump to urls: /verify/enter_password, /verify/personal_key
  • Expect to stay on phone confirmation step
  • Submit phone confirmation step
  • Expect to be able to use arrow keys to move around the flow

@soniaconnolly soniaconnolly requested a review from a team December 6, 2023 00:37
key: :verify_info,
controller: self,
next_steps: [:phone],
next_steps: [:phone, :request_letter],
Copy link
Contributor

Choose a reason for hiding this comment

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

Since you don't have to submit the phone step to get to RequestLetter, for FlowPolicy purposes it follows verify_info.


def phone_otp_sent?
user_phone_confirmation_session.present?
vendor_phone_confirmation && address_verification_mechanism == 'phone'
Copy link
Contributor

@soniaconnolly soniaconnolly Dec 6, 2023

Choose a reason for hiding this comment

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

Changed to use the vendor_phone_confirmation flag, which is always set at the same time that the user_phone_confirmation_session is created. This is a lot easier to manage in specs. And check the address_verification_mechanism to differentiate the phone step from the verify by mail flow.


it 'redirects to phone step if the user has not completed it' do
subject.idv_session.user_phone_confirmation = nil
subject.idv_session.vendor_phone_confirmation = 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 was just bad setup. vendor_phone_confirmation is set by the phone step, user_phone_confirmation is set by the phone_confirmation step.

context 'preconditions for agreement are present' do
it 'returns agreement' do
idv_session.welcome_visited = true
stub_up_to_key(key: :welcome, idv_session: idv_session)
Copy link
Contributor

Choose a reason for hiding this comment

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

I think this would read a little smoother:

Suggested change
stub_up_to_key(key: :welcome, idv_session: idv_session)
stub_up_to(:welcome, idv_session: idv_session)

Copy link
Contributor

Choose a reason for hiding this comment

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

Good idea! Done in e54aee0

@soniaconnolly soniaconnolly merged commit 38bb798 into main Dec 6, 2023
@soniaconnolly soniaconnolly deleted the doug-lg-11463-spec-helpers branch December 6, 2023 19:40
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