From 9a3257cb33f3e50e2209ff45551f19ce2be133b9 Mon Sep 17 00:00:00 2001 From: Alan Guo Xiang Tan Date: Thu, 4 May 2023 08:24:50 +0800 Subject: [PATCH] DEV: Fix system test failure when ran in parallel (#21377) What is the problem? The system tests incorrectly assumes that the discobot user which is seeded by a core plugin will always be present. This is not true as the discobot user will only be seeded when the test databases are migrated with plugins enabled. If we migrate test databases without plugins being enabled, the core system tests should still pass. --- spec/system/user_selector_spec.rb | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/spec/system/user_selector_spec.rb b/spec/system/user_selector_spec.rb index 5e90c29121c..3ad50ec0974 100644 --- a/spec/system/user_selector_spec.rb +++ b/spec/system/user_selector_spec.rb @@ -5,6 +5,11 @@ describe "User selector", type: :system, js: true do fab!(:post) { Fabricate(:post, topic: topic) } fab!(:current_user) { Fabricate(:admin) } + fab!(:user) do + SearchIndexer.enable + Fabricate(:user, username: "someone") + end + before do current_user.activate sign_in(current_user) @@ -14,11 +19,11 @@ describe "User selector", type: :system, js: true do it "correctly shows the user" do visit("/t/-/#{topic.id}") find(".btn-primary.create").click - find(".d-editor-input").fill_in(with: "Hello @dis") + find(".d-editor-input").fill_in(with: "Hello @som") within(".autocomplete.ac-user") do |el| - expect(el).to have_selector(".selected .avatar[title=discobot]") - expect(el.find(".selected .username")).to have_content("discobot") + expect(el).to have_selector(".selected .avatar[title=someone]") + expect(el.find(".selected .username")).to have_content("someone") end end end