From 477a67e4fb7a761b44ab0eb189de02f09d41f4bb Mon Sep 17 00:00:00 2001 From: Alan Guo Xiang Tan Date: Wed, 3 Apr 2024 10:04:48 +0800 Subject: [PATCH] DEV: Fix flaky system test (#26479) Why this change? `expect(page.title).to starts_with("...")` does not rely on capybara waiters. This commit switches us to use `have_title` instead which will rely on Capybara waiters. --- plugins/chat/spec/system/document_title_spec.rb | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/plugins/chat/spec/system/document_title_spec.rb b/plugins/chat/spec/system/document_title_spec.rb index 83250eae3d7..6349fa6cefd 100644 --- a/plugins/chat/spec/system/document_title_spec.rb +++ b/plugins/chat/spec/system/document_title_spec.rb @@ -17,7 +17,7 @@ RSpec.describe "Document title", type: :system do it "shows the channel name in the document title" do chat_page.visit_channel(channel_1) - expect(page.title).to start_with("##{channel_1.title}") + expect(page).to have_title("##{channel_1.title}") end end @@ -33,7 +33,7 @@ RSpec.describe "Document title", type: :system do it "shows the channel name in the document title" do chat_page.visit_channel(channel_1) - expect(page.title).to start_with("#{channel_1.title(current_user)}") + expect(page).to have_title("#{channel_1.title(current_user)}") end end end