mirror of
https://gh.wpcy.net/https://github.com/discourse/discourse.git
synced 2026-05-15 02:27:29 +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.
40 lines
1.3 KiB
Ruby
40 lines
1.3 KiB
Ruby
# frozen_string_literal: true
|
|
|
|
RSpec.describe "Rss Polling - admin", type: :system do
|
|
fab!(:current_user, :admin)
|
|
fab!(:category_1, :category)
|
|
fab!(:tag_1, :tag)
|
|
|
|
let(:url) { "http://example.com/rss" }
|
|
|
|
before do
|
|
SiteSetting.rss_polling_enabled = true
|
|
sign_in(current_user)
|
|
end
|
|
|
|
it "can save an rss polling configuration" do
|
|
visit("/admin/plugins/rss_polling")
|
|
|
|
find(".add-rss-polling-feed").click
|
|
find(".rss-polling-feed-url").fill_in(with: url)
|
|
find(".rss-polling-feed-updates").fill_in(with: "updates")
|
|
user = PageObjects::Components::SelectKit.new(".rss-polling-feed-user")
|
|
user.search(current_user.username)
|
|
user.select_row_by_value(current_user.username)
|
|
category = PageObjects::Components::SelectKit.new(".rss-polling-feed-category")
|
|
category.search(category_1.name)
|
|
category.select_row_by_value(category_1.id)
|
|
tag = PageObjects::Components::SelectKit.new(".rss-polling-feed-tag")
|
|
tag.search(tag_1.name)
|
|
tag.select_row_by_value(tag_1.name)
|
|
find(".save-rss-polling-feed").click
|
|
|
|
expect(DiscourseRssPolling::RssFeed.last).to have_attributes(
|
|
url:,
|
|
author: current_user.username,
|
|
category_filter: "updates",
|
|
category_id: category_1.id,
|
|
tags: tag_1.name,
|
|
)
|
|
end
|
|
end
|