mirror of
https://gh.wpcy.net/https://github.com/discourse/discourse.git
synced 2026-05-06 11:58:15 +08:00
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.
21 lines
602 B
Ruby
21 lines
602 B
Ruby
# frozen_string_literal: true
|
|
|
|
describe "Admin Badges Grouping Modal", type: :system do
|
|
before { SiteSetting.enable_badges = true }
|
|
|
|
fab!(:current_user, :admin)
|
|
|
|
let(:badges_page) { PageObjects::Pages::AdminBadges.new }
|
|
let(:badges_groupings_page) { PageObjects::Pages::AdminBadgesGroupings.new }
|
|
|
|
before { sign_in(current_user) }
|
|
|
|
context "when adding a new grouping" do
|
|
it "saves it" do
|
|
badges_page.visit_page(Badge::Autobiographer).edit_groupings
|
|
badges_groupings_page.add_grouping("a new grouping")
|
|
|
|
BadgeGrouping.exists?(name: "a new grouping")
|
|
end
|
|
end
|
|
end
|