Skip to content

HOMS-523 Fix flaky feature specs#808

Open
kompl wants to merge 1 commit into
masterfrom
HOMS-523
Open

HOMS-523 Fix flaky feature specs#808
kompl wants to merge 1 commit into
masterfrom
HOMS-523

Conversation

@kompl

@kompl kompl commented Jul 13, 2026

Copy link
Copy Markdown
Contributor

Stabilize the feature suite before bumping major gem versions, so that the effect of the bump can be measured against a green baseline.

  • delete_user_spec: wait for the sign in to complete before visiting /users, otherwise the navigation cancels the in-flight POST and the test lands on the login page (42% of runs). Replace the legacy current_path assertion with the retrying have_current_path (8%).
  • expect_widget_presence: all() ignores :wait unless a count expectation is given, so it returned an empty list before the widget had rendered (17% of runs in new_order_spec). Use have_css, which retries.
  • wait_for_ajax: poll with an interval instead of a busy loop, which flooded the CDP channel with evaluate_script calls while the page was re-rendering.
  • Drop Capybara.automatic_reload = false: it disables the re-lookup of stale nodes and is the source of the "stale element reference" and "Node with given id does not belong to the document" errors.

Puma 7.2.0 -> 8.0.2, selenium-webdriver 4.41.0 -> 4.46.0. `parallel` reaches
the lockfile only through rubocop and takes no part in running the specs.

The suite was flaky before the bumps — delete_user_spec failed in 42% of
master's runs — so the rest of this is the baseline they need.

* Puma 8 binds to :: rather than 0.0.0.0 once a non-loopback IPv6 interface is
  up, which would leave the address it listens on depending on the host it boots
  at. Pin it, as config/unicorn.rb does. Puma is a development and test
  dependency; production runs on unicorn.
* The Capybara server ran on Threads '0:1' with queue_requests off, which is
  puma#876: the pool trims its last thread while the server waits for one, and
  with no reactor to hold the request it waits for a worker nothing will spawn.
  Run it 1:1, as production does.
* delete_user_spec: signin does not wait for the login to complete, and the spec
  visited /users straight after, cancelling the in-flight POST. Add the barrier
  the other feature specs have.
* expect_widget_presence: all() ignores :wait unless a count expectation is
  given, so it returned an empty list before the widget had rendered. Use
  have_css.
* Drop Capybara.automatic_reload = false. It disables the re-lookup of stale
  nodes and is behind the "stale element reference" and "Node with given id does
  not belong to the document" errors.
* translation_spec: the widget picks its translations by the locale the page
  handed it when it mounted, so a locale set mid-example never reached it.
  Render the page again on the spot.
* The progress formatter prints one dot per example on a single unterminated
  line, and CI renders logs line by line, so a run only appeared once it ended.
  One line per example instead.
* Provision yarn with corepack, which takes the version from packageManager.
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.

1 participant