LG-10228: Updated F/T unlock content for error states#8775
Conversation
…y for face or touch unlock error messages
aduth
left a comment
There was a problem hiding this comment.
Couple minor comments on specs, but otherwise LGTM 👍
| 'errors.webauthn_platform_setup.account_setup_error', | ||
| link: link_to( | ||
| I18n.t('errors.webauthn_platform_setup.choose_another_method'), | ||
| '/authentication_methods_setup', |
There was a problem hiding this comment.
Can we use the URL helper here, so that it doesn't fall out of sync with the route definition?
| '/authentication_methods_setup', | |
| authentication_methods_setup_path, |
There was a problem hiding this comment.
This is something that I am finding tricky to work through. I was using the hard-coded to affirm that the test would pass and then make it in sync. I just don't know which avenue to go down at this point.
With both include ActionView::Helpers::UrlHelper and include Rails.application.routes.url_helpers added to the file, I would get an undefined local variable or method 'controller' error.
Then, if I took out both include helpers, I would get an undefined local variable or method 'authentication_methods_setup_path'
Thoughts?
There was a problem hiding this comment.
Hm, very strange, the error message isn't particularly helpful either.
I was able to get a more useful error stack trace by adding a rescue block with a binding.pry, which points back to this being related to url_options.
=> ["/ruby/gems/3.2.0/gems/rspec-expectations-3.12.3/lib/rspec/matchers.rb:968:in `method_missing'",
"/ruby/gems/3.2.0/gems/rspec-core-3.12.2/lib/rspec/core/example_group.rb:767:in `method_missing'",
"/ruby/gems/3.2.0/gems/actionview-7.0.5.1/lib/action_view/routing_url_for.rb:125:in `url_options'",
"/ruby/gems/3.2.0/gems/actionpack-7.0.5.1/lib/action_dispatch/routing/route_set.rb:263:in `call'",
"/ruby/gems/3.2.0/gems/actionpack-7.0.5.1/lib/action_dispatch/routing/route_set.rb:327:in `block in define_url_helper'",
"/identity-idp/spec/forms/webauthn_visit_form_spec.rb:106:in `block (5 levels) in <top (required)>'",
...
Out of a hunch, I added url_options as a let memoized variable to get it "in scope", and... that seemed enough to get it to pass? 🤷
Passing diff:
diff --git a/spec/forms/webauthn_visit_form_spec.rb b/spec/forms/webauthn_visit_form_spec.rb
index a34241728..c2d32412e 100644
--- a/spec/forms/webauthn_visit_form_spec.rb
+++ b/spec/forms/webauthn_visit_form_spec.rb
@@ -4,4 +4,6 @@ RSpec.describe WebauthnVisitForm do
include ActionView::Helpers::UrlHelper
+ include Rails.application.routes.url_helpers
let(:user) { build(:user) }
+ let(:url_options) { {} }
let(:subject) do
@@ -9,3 +11,3 @@ RSpec.describe WebauthnVisitForm do
user: user,
- url_options: {},
+ url_options:,
in_mfa_selection_flow: true,
@@ -104,3 +106,3 @@ RSpec.describe WebauthnVisitForm do
I18n.t('errors.webauthn_platform_setup.choose_another_method'),
- '/authentication_methods_setup',
+ authentication_methods_setup_path,
),
🎫 Ticket
LG-10228: Updated F/T unlock content for error states
🛠 Summary of changes
This PR improves messaging for when a user does not complete setup for F/T unlock.
📜 Testing Plan
Scenario 1: User sets up a new account and fails setup
Scenario 2: Failed setup for an account already has face/touch unlock on same device
Scenario 3: User with an existing account fails Face/Touch unlock setup
👀 Screenshots