Skip to content

Switch to have_current_path for MFA path comparison#10221

Merged
aduth merged 1 commit intomainfrom
aduth-have-current-path
Mar 8, 2024
Merged

Switch to have_current_path for MFA path comparison#10221
aduth merged 1 commit intomainfrom
aduth-have-current-path

Conversation

@aduth
Copy link
Contributor

@aduth aduth commented Mar 8, 2024

🛠 Summary of changes

Updates flakey specs to use expect(page).to have_current_path … instead of expect(current_path).to eq ….

These tests have been shown to be occasionally flakey.

Examples:

Related Slack discussion: https://gsa-tts.slack.com/archives/C01710KMYUB/p1709311154032829

The hypothesis is there's a race condition where the test signs in with a new user and assumes to arrive at the MFA setup screen. This does happen, but only after a series of redirects, where the sign_in_before_mfa helper attempts to visit the account page.

The thought with using have_current_path is that it may help avoid some issues where the previous assertion would be made before the redirect is fully completed. While we don't allow any default wait, Capybara internally uses its document.synchronize logic which may still help "against asynchronicity problems" even if there is no measurable wait delay.

📜 Testing Plan

rspec spec/features/two_factor_authentication/multiple_mfa_sign_up_spec.rb

changelog: Internal, Automated Testing, Improve reliability of automated tests
@aduth aduth requested a review from mitchellhenke March 8, 2024 18:19
@aduth aduth merged commit 7b7e529 into main Mar 8, 2024
@aduth aduth deleted the aduth-have-current-path branch March 8, 2024 19:48
@aduth
Copy link
Contributor Author

aduth commented Mar 8, 2024

Follow-up: It appears this did not help, as there's still failures from these specs after this change.

Example: https://gitlab.login.gov/lg/identity-idp/-/jobs/1069991

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