fix: flaky volunteers & supervisors system specs #6006
Merged
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.
What github issue is this PR for, if any?
No issue -- I have seen this spec cause failures locally and in CI.
What changed, and why?
spec/system/volunteers/index_spec.rb
:55
&:400
were the most common failures, roughly 90% of my local runs I would guess. I was running specs in 'defined' order, not random, and I think it was happening more consistently that way.I ran some rubocop-capybara auto fixes while troubleshooting - figured I may as well leave those changes in for good measure.
It seems like the
travel_to
calls were the major culprit. Addingtravel_back
s helped, but I do not see why they are necessary, so I just removed them. The other major issue was the sign_out -> visit -> sign_in -> visit sequence, the spec would get kicked out to the sign in page. I changed the sequence to arefresh
call. I think a page refresh still properly tests the feature?