canvas-lms/spec/helpers
Michael Hulse 64fb8965ee fix: hide SMS tab when MFA is disabled
Note that this commit reapplies a revert by fixing an issue
relating to the mfa_settings logic in my previous commit
(g/352986) and the reversion (g/352487).

The previous commit broke the build post-merge due to me
missing some failing tests in:
spec/views/profile/_ways_to_contact.html.erb_spec.rb

Our crystalball tool does not map any of the erb files to
tests, so when the previous commit (g/352986) predicted
which tests to run it only ran:
spec/selenium/profile/profile_spec.rb

The broken tests have been fixed in this commit, plus it
includes the addition of the original code fixes.

This commit fixes the logic that controls the display of
the SMS tab when MFA is disabled for the account.

Specifically, the “Text (SMS)” tab in the “+ Contact Method”
will only be visible when in a US region and MFA is enabled.

Other improvements:

- optimized a few translations (removed keys)
- updated “Multi-Factor Authentication Backup Codes” to
  only show if MFA is NOT disabled
- added helper + tests for app/helpers/profile_helper.rb
  - added ProfileHelper per feedback in previous commit
  - this is following the pattern we used for OtpHelper
- updated tests relating to the “+ Contact Method” modal
- added tests for the user profile MFA button logic
- added tests for _ways_to_contact.html.erb

closes FOO-4581
refs FOO-4465
flag=none

test plan, part A:
- log in to Canvas
- visit /profile/settings
- click “+ Contact Method”
- “Text (SMS)” tab SHOULD NOT BE visible
- multi-factor authentication buttons SHOULD NOT BE visible

part B:
- in a new tab visit /accounts/<id>/settings#tab-settings
- set “Multi-Factor Authentication” to “Optional”
- click “Update Settings”
- reload the /profile/settings page
- click “+ Contact Method”
- “Text (SMS)” tab SHOULD NOT BE visible (must be in US region)
- multi-factor authentication buttons SHOULD BE visible

part C:
- for testing US region, update otp_via_sms_in_us_region? to
  always return true
    - for local dev, this will probably be false by default
- reload the /profile/settings page
- click “+ Contact Method”
- “Text (SMS)” tab SHOULD BE visible
- multi-factor authentication buttons SHOULD BE visible

part D:
- repeat “part B” and “part C” for each of these other
  “Multi-Factor Authentication” settings:
    1. “Required for Admins” (test using Admin)
    2. “Required”

misc:
- expect new, updated and existing tests to pass

[skip-crystalball]

Change-Id: I896771910dd9783cf1804465574242d38ba4c5f5
Reviewed-on: https://gerrit.instructure.com/c/canvas-lms/+/353438
Reviewed-by: Jason Perry <jason.perry@instructure.com>
QA-Review: Michael Hulse <michael.hulse@instructure.com>
Product-Review: Michael Hulse <michael.hulse@instructure.com>
Tested-by: Service Cloud Jenkins <svc.cloudjenkins@instructure.com>
2024-07-25 19:25:02 +00:00
..
login remove carrier from otp/mfa screens 2024-06-26 21:58:26 +00:00
messages RuboCop: Style/StringLiterals, Style/StringLiteralsInInterpolation 2021-11-25 14:03:06 +00:00
accounts_helper_spec.rb RuboCop: Style/StringLiterals, Style/StringLiteralsInInterpolation 2021-11-25 14:03:06 +00:00
alignments_helper_spec.rb RuboCop: Style/StringLiterals, Style/StringLiteralsInInterpolation 2021-11-25 14:03:06 +00:00
application_helper_spec.rb Disable Canvas Calendar and Planner in Limited Access Accounts 2024-07-18 23:03:41 +00:00
assessment_request_helper_spec.rb rubocop: Layout/Multiline*LineBreaks 2023-05-01 19:31:42 +00:00
assignments_helper_spec.rb display minus instead of en-dash 2023-10-09 16:24:10 +00:00
attachment_helper_spec.rb Rubocop for ruby 3.1 2023-06-06 16:44:26 +00:00
avatar_helper_spec.rb remove OpenObject usage 2024-04-23 17:47:19 +00:00
broken_link_helper_spec.rb Remove default @unauthorized_message 2024-07-23 20:45:49 +00:00
canvas_outcomes_helper_spec.rb Revert "Block outcome deletion if there are OS alignments" 2024-01-08 17:38:18 +00:00
collaborations_helper_spec.rb bump rubocop gems and apply changes 2023-08-07 20:13:35 +00:00
context_external_tools_helper_spec.rb support tray launch_method 2024-04-19 16:23:04 +00:00
context_modules_helper_spec.rb bump rubocop gems and apply changes 2023-08-07 20:13:35 +00:00
conversations_helper_spec.rb Add settings to disable signature & auto response for students 2024-06-06 19:36:32 +00:00
courses_helper_spec.rb Sortable User Course List 2024-05-29 17:42:41 +00:00
custom_color_helper_spec.rb RuboCop: Style/StringLiterals, Style/StringLiteralsInInterpolation 2021-11-25 14:03:06 +00:00
cyoe_helper_spec.rb rubocop: prep for updating rubocop-rspec 2023-04-12 19:30:10 +00:00
dashboard_helper_spec.rb RuboCop: Style/StringLiterals, Style/StringLiteralsInInterpolation 2021-11-25 14:03:06 +00:00
datadog_rum_helper_spec.rb make dynamic settings writable in dev/oss 2024-01-23 15:20:56 +00:00
default_due_time_helper_spec.rb inheritable account/course setting for default due time 2022-03-10 20:45:01 +00:00
gradebooks_helper_spec.rb don't use OpenStruct in Workflow 2024-05-10 16:16:43 +00:00
grading_periods_helper_spec.rb RuboCop: Style/StringLiterals, Style/StringLiteralsInInterpolation 2021-11-25 14:03:06 +00:00
graphql_type_tester.rb bump graphql to latest 2.1.x 2024-04-16 14:49:02 +00:00
heap_helper_spec.rb add sampling to our heap sessions 2024-04-10 13:36:26 +00:00
inst_llm_helper_spec.rb Fix redis "multi" use for discussion summarization 2024-07-03 23:39:56 +00:00
k5_common.rb Add use_classic_font? helper 2023-03-27 16:22:19 +00:00
mock_static_site_spec.rb RuboCop: Style/StringLiterals, Style/StringLiteralsInInterpolation 2021-11-25 14:03:06 +00:00
new_quizzes_features_helper_spec.rb export New Quizzes in common cartridges even if NQ is not enabled 2024-05-31 14:19:51 +00:00
observer_enrollments_helper_spec.rb Rubocop for ruby 3.1 2023-06-06 16:44:26 +00:00
outcome_result_resolver_helper_spec.rb Add caching to converted OS LORs 2023-02-23 20:33:06 +00:00
outcomes_features_helper_spec.rb rubocop: prep for updating rubocop-rspec 2023-04-12 19:30:10 +00:00
outcomes_request_batcher_spec.rb Reduce the max allowable request size to Outcomes 2022-12-02 16:57:51 +00:00
outcomes_service_alignments_helper_spec.rb Revert "Block outcome deletion if there are OS alignments" 2024-01-08 17:38:18 +00:00
outcomes_service_authoritative_results_helper_spec.rb Rubocop for ruby 3.1 2023-06-06 16:44:26 +00:00
pact_api_consumer_proxy_spec.rb RuboCop: Style/StringLiterals, Style/StringLiteralsInInterpolation 2021-11-25 14:03:06 +00:00
profile_helper_spec.rb fix: hide SMS tab when MFA is disabled 2024-07-25 19:25:02 +00:00
quizzes_helper_spec.rb rubocop: Layout/Multiline*LineBreaks 2023-05-01 19:31:42 +00:00
rrule_helper_spec.rb Update calendar series natural language to handle leap day 2023-09-06 13:31:00 +00:00
search_helper_spec.rb enable granular permissions features in all envs 2023-09-25 23:17:32 +00:00
section_tab_helper_spec.rb Disable Course Files Page in Limited Access Accounts 2024-07-18 23:03:55 +00:00
selective_release_common.rb turn diff mods on for CI and dev 2024-06-14 18:31:58 +00:00
sis_import_helper_spec.rb Rubocop for ruby 3.1 2023-06-06 16:44:26 +00:00
stream_items_helper_spec.rb Revert "link to new assignment page when a2 enabled" 2024-05-09 16:04:24 +00:00
submissions_helper_spec.rb Create API for calculating student entered What-If scores 2024-07-16 17:40:51 +00:00
syllabus_helper_spec.rb RuboCop: Style/StringLiterals, Style/StringLiteralsInInterpolation 2021-11-25 14:03:06 +00:00
url_helper_spec.rb support new quizzes for SG2 2024-06-26 18:28:51 +00:00
web_zip_export_helper_spec.rb rubocop: prep for updating rubocop-rspec 2023-04-12 19:30:10 +00:00
will_paginate_helper_spec.rb rubocop: Layout/Multiline*LineBreaks 2023-05-01 19:31:42 +00:00