discourse/plugins/discourse-ai/spec/system
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
..
ai_bot DEV: Add client settled checks for system tests (#35230) 2025-10-10 11:03:18 +08:00
ai_helper DEV: Update rubocop-discourse to 3.13 and autofix issues (#35073) 2025-10-06 16:11:01 +02:00
ai_moderation DEV: Add client settled checks for system tests (#35230) 2025-10-10 11:03:18 +08:00
embeddings DEV: Update rubocop-discourse to 3.13 and autofix issues (#35073) 2025-10-06 16:11:01 +02:00
llms DEV: Update rubocop-discourse to 3.13 and autofix issues (#35073) 2025-10-06 16:11:01 +02:00
page_objects FIX: AI usage doesn't refresh custom date ranges correctly (#34816) 2025-09-16 10:16:01 -07:00
summarization DEV: Update rubocop-discourse to 3.13 and autofix issues (#35073) 2025-10-06 16:11:01 +02:00
admin_ai_features_spec.rb DEV: Update rubocop-discourse to 3.13 and autofix issues (#35073) 2025-10-06 16:11:01 +02:00
admin_ai_persona_spec.rb DEV: Add client settled checks for system tests (#35230) 2025-10-10 11:03:18 +08:00
admin_ai_translations_spec.rb UX: make translations easier to set up by showing requisite site setting (#35078) 2025-10-07 11:23:45 -04:00
admin_dashboard_spec.rb
ai_artifact_key_value_api_spec.rb
ai_usage_spec.rb FIX: AI usage doesn't refresh custom date ranges correctly (#34816) 2025-09-16 10:16:01 -07:00
ai_user_preferences_spec.rb FEATURE: Promote Discover to a dedicated feature. (#34846) 2025-09-23 14:01:45 -03:00
core_features_spec.rb