Skip to content

Bug 2090252 - Wait for the TOTP enrollment and verification API calls in 2_test_login_totp.t - #2817

Merged
dklawren merged 2 commits into
mozilla:masterfrom
Xzzz:bug-2090252
Nov 6, 2026
Merged

dklawren merged 2 commits into
mozilla:masterfrom
Xzzz:bug-2090252

Conversation

@Xzzz

@Xzzz Xzzz commented Nov 6, 2026

Copy link
Copy Markdown
Collaborator

Summary

Makes qa/t/2_test_login_totp.t wait for the page to update after each TOTP API call, instead of checking it right away, which made test_selenium_2 fail intermittently.

Enrollment fills in the secret only after user/mfa/totp/enroll returns (js/account.js), and the verification page checks the code with user/mfa/verify_totp_code before it submits the form (js/mfa_totp.js). The test read the secret, the error text and the page title before those calls returned.

Changes

  • New wait_until helper in the test, polling once per second up to WAIT_TIME, like 2_test_login_duo.t already does for its title.
  • Enrollment waits for the secret before reading it.
  • Each Submit on the verification page waits for the error text (invalid code) or for the next page (valid code).

Test plan

  • 2_test_login_totp.t passes
  • With a 3-second delay added before the API calls in js/account.js and js/mfa_totp.js, it still passes, while the test on master fails at line 91

References

@Xzzz
Xzzz requested a review from dklawren November 6, 2026 19:26

@dklawren dklawren left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

LGTM r=dkl

@dklawren
dklawren merged commit fee3dd8 into mozilla:master Nov 6, 2026
13 of 14 checks passed
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.

2 participants