DEV: Fix flaky thread navigation spec (#22323)

Introduced in cec68b3e2c,
this is flaky because if you click the back button before
the route is fully transitioned to the loaded thread,
we end up going to the history _before_ the thread list,
which ends up being the channel.

We need to make sure that everything is loaded for the
thread first, meaning the skeleton is not there.

Also exclude some noise from the capybara logs (image load failures)
This commit is contained in:
Martin Brennan 2023-06-28 17:20:05 +10:00 committed by GitHub
parent c4c566846d
commit ccdc0822a8
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 14 additions and 2 deletions

View File

@ -137,7 +137,7 @@ RSpec.describe "Navigation", type: :system do
before do
SiteSetting.enable_experimental_chat_threaded_discussions = true
category_channel.update!(threading_enabled: true)
Fabricate(:chat_message, thread: thread)
Fabricate(:chat_message, thread: thread, chat_channel: thread.channel)
thread.add(current_user)
end

View File

@ -13,6 +13,7 @@ module PageObjects
else
has_css?(".chat-side-panel .chat-thread")
end
PageObjects::Pages::ChatThread.new.has_no_loading_skeleton?
end
def has_no_open_thread?

View File

@ -433,7 +433,18 @@ RSpec.configure do |config|
if logs.empty?
lines << "(no logs)"
else
logs.each { |log| lines << log.message }
logs.each do |log|
# System specs are full of image load errors that are just noise, no need
# to log this.
if (
log.message.include?("Failed to load resource: net::ERR_CONNECTION_REFUSED") &&
(log.message.include?("uploads") || log.message.include?("images"))
) || log.message.include?("favicon.ico")
next
end
lines << log.message
end
end
lines << "~~~~~ END JS LOGS ~~~~~"
end