Skip to content

Race Condition Check: spec/system/supervisors/edit_spec.rb#6781

Open
stefannibrasil wants to merge 2 commits intorubyforgood:mainfrom
hexdevs:sb-supervisors-system-test-6317
Open

Race Condition Check: spec/system/supervisors/edit_spec.rb#6781
stefannibrasil wants to merge 2 commits intorubyforgood:mainfrom
hexdevs:sb-supervisors-system-test-6317

Conversation

@stefannibrasil
Copy link
Contributor

What github issue is this PR for, if any?

Resolves #6317

What changed, and why?

When github's free CI servers are under heavy load, a race condition
between the page loading and checking the database causes tests to flake.
This is caused by a system test inputting data into a form then
immediately checking the database without waiting for the form to finish submitting.

For every database check in the system files, this ensures it's preceded
by a capybara matcher with automatic waiting or replace the database
check with a check for something to appear on the page.

I also took the opportunity to refactor some small things:

  • only add :js to contexts when necessary since removing it keeps the tests faster
  • instead of checking for CSS selectors, change interaction to how the user interacts with buttons

When github's free CI servers are under heavy load, a race condition
between the page loading and checking the database causes tests to flake.
This is caused by a system test inputting data into a form then
immediately checking the database without waiting for the form to finish submitting.

For every database check in the system files, this ensures it's preceded
by a capybara matcher with automatic waiting or replace the database
check with a check for something to appear on the page.
This can help with speeding up tests by using
`:js` to contexts only when necessary.
@github-actions github-actions bot added ruby Pull requests that update Ruby code Tests! 🎉💖👏 labels Mar 16, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

ruby Pull requests that update Ruby code Tests! 🎉💖👏

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Race Condition Check: spec/system/supervisors/edit_spec.rb

1 participant