E2e: Fix flakiness on password reset
What does this MR do and why?
This is related to https://gitlab.com/gitlab-org/quality/e2e-test-issues/-/issues/859 and a continuation the attempted fix in !197799 (merged)
With this MR, we ensure if an exception is encountered, we repeat the process from the start by first navigating to the login page.
This MR attempts the fix by visiting the homepage if the CSRF authenticity error is shown. Since login was already performed, the user will be redirected to the new password page.
References
- gitlab-org/quality/e2e-test-issues#797 (comment 2627923295)
- https://gitlab.com/gitlab-org/quality/e2e-test-issues/-/issues/859
Screenshots or screen recordings
| Before | After |
|---|---|
How to set up and validate locally
Copying from the previous MR:
# reset test user password to force the password reset flow
$ bundle exec rails console
> User.find_by_username("root").update!(password_expires_at: 1.day.ago)
# run some E2E tests that run via the UI, note on first run should perform password reset flow
$ bundle exec rspec qa/specs/features/browser_ui/2_plan/issue/create_issue_spec.rb
MR acceptance checklist
Evaluate this MR against the MR acceptance checklist. It helps you analyze changes to reduce risks in quality, performance, reliability, security, and maintainability.
Edited by Sanad Liaquat