discourse/bin
Alan Guo Xiang Tan 55b05c921b
DEV: Add client settled checks for system tests (#35230)
This change seeks to improve the reliability of our system tests by
resolving the lack of consistency in the state of the client side
application between steps in a system test. This is achieved by patching
various action methods in `Capybara::Playwright::Node` and
`Capybara::Playwright::Browser` so that the methods execute an async
JavaScript function on the client side that waits for the client side
application to reach a settled state. A settled state is currently
defined as:

1. No inflight ajax requests. (_messageBus and presence requests are
excluded_)
2. 2 event cycles of the Javascript event loop has happened for for all
"click", "input", "mousedown", "keydown", "focusin", "focusout",
"touchstart", "change", "resize", "scroll" DOM events that fired.

For debugging purposes, a `--debug-client-settled` CLI flag has been
added to `bin/rspec`. When used, detailed debugging information will be
printed to the browser's console as well as to `stdout` of the
`bin/rspec` process.

This change was inspired by
https://evilmartians.com/chronicles/flaky-tests-be-gone-long-lasting-relief-chronic-ci-retry-irritation
and the https://github.com/makandra/capybara-lockstep rubygem.
2025-10-10 11:03:18 +08:00
..
docker DEV: Run db:create in Docker dev container (#29295) 2024-10-24 12:19:42 +02:00
annotaterb DEV: Upgrade Rails to version 8.0.2 2025-07-22 09:59:44 +02:00
bundle DEV: Enable unless cops 2023-02-21 10:30:48 +01:00
dev DEV: Add basic bin/dev script for launching in development (#23254) 2023-08-25 12:07:16 +08:00
ember-cli DEV: remove deps (#32628) 2025-05-07 19:09:42 +02:00
lint DEV: align bin/lint to use lefthook (#34247) 2025-08-13 12:49:14 +10:00
notify_file_change FIX: notify_file_change was outputting a command to vim 2020-12-10 10:03:57 -05:00
rails DEV: Compatibility with TruffleRuby (#16641) 2022-05-05 09:50:02 +08:00
rake DEV: Add rake plugins:turbo_spec task (#18289) 2022-09-20 15:42:54 +01:00
rspec DEV: Add client settled checks for system tests (#35230) 2025-10-10 11:03:18 +08:00
rubocop DEV: Clean up .gitignore (#12981) 2021-05-10 13:43:13 +02:00
system_rspec DEV: Minimal first pass of rails system test setup (#16311) 2022-09-28 11:48:16 +10:00
turbo_rspec DEV: Improve turbo_rspec and flaky-test output (#35059) 2025-09-30 10:01:58 +01:00
unicorn DEV: clear asset cache when plugins add/remove client.*.yml files (#29468) 2024-10-29 15:17:59 +00:00