DEV: Unskip system tests and avoid predicate matchers (#224)

RSpec predicate matchers provide poor output when tests fail.
This commit switches to Capybara RSpec matches so that we get more
debugging information as to why these tests are flaky...
This commit is contained in:
Alan Guo Xiang Tan 2024-07-10 10:38:29 +08:00 committed by GitHub
parent aa5d6f9ee8
commit fe25a76fe3
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 8 additions and 38 deletions

View File

@ -4,25 +4,16 @@ require_dependency "docker_manager/git_repo"
RSpec.describe "Admin update", type: :system do
fab!(:admin)
let(:au_page) { PageObjects::Pages::AdminUpdate.new }
let(:admin_update_page) { PageObjects::Pages::AdminUpdate.new }
before do
sign_in(admin)
au_page.visit
end
before { sign_in(admin) }
# flaky test /t/133037
xit "shows the update page" do
expect(au_page).to be_displayed
end
it "displays the admin update page with the right respositories" do
visit("/admin/update")
# flaky test /t/133033
xit "shows the core repo" do
expect(au_page).to have_repo(name: "Discourse")
end
# flaky test /t/133032
xit "shows the docker_manager plugin repo" do
expect(au_page).to have_repo(name: "Docker Manager", url: "https://meta.discourse.org/t/12655")
expect(page).to have_css("h3", exact_text: I18n.t("js.admin.docker.update_title"))
expect(page).to have_css("tr.repo .repo__name", exact_text: "Discourse")
expect(page).to have_css("tr.repo .repo__name", exact_text: "Docker Manager")
expect(page).to have_css("tr.repo .repo__about a[href='https://meta.discourse.org/t/12655']")
end
end

View File

@ -1,21 +0,0 @@
# frozen_string_literal: true
module PageObjects
module Pages
class AdminUpdate < PageObjects::Pages::Base
def visit
page.visit("/admin/update")
self
end
def displayed?
has_css?("h3", text: "Updates")
end
def has_repo?(repo)
has_css?("tr.repo .repo__name", text: repo[:name]) &&
(!repo[:url] || has_css?("tr.repo .repo__about a[href='#{repo[:url]}']"))
end
end
end
end