Switch to have_current_path for MFA path comparison#10221
Merged
Conversation
changelog: Internal, Automated Testing, Improve reliability of automated tests
mitchellhenke
approved these changes
Mar 8, 2024
Contributor
Author
|
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 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
🛠 Summary of changes
Updates flakey specs to use
expect(page).to have_current_path …instead ofexpect(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_mfahelper attempts to visit the account page.The thought with using
have_current_pathis 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 itsdocument.synchronizelogic which may still help "against asynchronicity problems" even if there is no measurable wait delay.📜 Testing Plan