From fe25a76fe3eeaa6b8500d02be32b1350791aac68 Mon Sep 17 00:00:00 2001 From: Alan Guo Xiang Tan Date: Wed, 10 Jul 2024 10:38:29 +0800 Subject: [PATCH] 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... --- spec/system/admin_update_spec.rb | 25 ++++++------------- .../system/page_objects/pages/admin_update.rb | 21 ---------------- 2 files changed, 8 insertions(+), 38 deletions(-) delete mode 100644 spec/system/page_objects/pages/admin_update.rb diff --git a/spec/system/admin_update_spec.rb b/spec/system/admin_update_spec.rb index e1aedad..c3a5c0d 100644 --- a/spec/system/admin_update_spec.rb +++ b/spec/system/admin_update_spec.rb @@ -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 diff --git a/spec/system/page_objects/pages/admin_update.rb b/spec/system/page_objects/pages/admin_update.rb deleted file mode 100644 index 8478829..0000000 --- a/spec/system/page_objects/pages/admin_update.rb +++ /dev/null @@ -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