A platform for community discussion. Free, open, simple.
DEV: fix flakey spec (#26513)
Joffrey JAFFEUXf45d96ebf42b
diff --git a/plugins/chat/spec/system/chat_channel_spec.rb b/plugins/chat/spec/system/chat_channel_spec.rbindex 79e2cd016f7..5c9c03ed99c 100644--- a/plugins/chat/spec/system/chat_channel_spec.rb+++ b/plugins/chat/spec/system/chat_channel_spec.rb@@ -59,7 +59,7 @@ RSpec.describe "Chat channel", type: :system doendcontext "when first batch of messages doesnt fill page" do- before { 30.times { Fabricate(:chat_message, user: current_user, chat_channel: channel_1) } }+ before { Fabricate.times(30, :chat_message, user: current_user, chat_channel: channel_1) }it "autofills for more messages" dochat_page.prefers_full_page@@ -76,7 +76,7 @@ RSpec.describe "Chat channel", type: :system docontext "when sending a message" docontext "with lots of messages" do- before { 50.times { Fabricate(:chat_message, chat_channel: channel_1) } }+ before { Fabricate.times(50, :chat_message, chat_channel: channel_1) }it "loads most recent messages" dounloaded_message = Fabricate(:chat_message, chat_channel: channel_1)@@ -128,7 +128,7 @@ RSpec.describe "Chat channel", type: :system doendcontext "when clicking the arrow button" do- before { 50.times { Fabricate(:chat_message, chat_channel: channel_1) } }+ before { Fabricate.times(50, :chat_message, chat_channel: channel_1) }it "jumps to the bottom of the channel" dounloaded_message = Fabricate(:chat_message, chat_channel: channel_1)@@ -148,7 +148,7 @@ RSpec.describe "Chat channel", type: :system docontext "when returning to a channel where last read is not last message" doit "jumps to the bottom of the channel" dochannel_1.membership_for(current_user).update!(last_read_message: message_1)- messages = 50.times.map { Fabricate(:chat_message, chat_channel: channel_1) }+ messages = Fabricate.times(50, :chat_message, chat_channel: channel_1)chat_page.visit_channel(channel_1)expect(page).to have_css("[data-id='#{messages.first.id}']")@@ -157,16 +157,13 @@ RSpec.describe "Chat channel", type: :system doendcontext "when a new message is created" do- fab!(:other_user) { Fabricate(:user) }-- before do- channel_1.add(other_user)- 50.times { Fabricate(:chat_message, chat_channel: channel_1) }- end+ before { Fabricate.times(50, :chat_message, chat_channel: channel_1) }it "doesn’t append the message when not at bottom" dovisit("/chat/c/-/#{channel_1.id}/#{message_1.id}")+ expect(page).to have_css(".chat-scroll-to-bottom__button.visible")+new_message = Fabricate(:chat_message, chat_channel: channel_1, use_service: true)expect(channel_page.messages).to have_no_message(id: new_message.id)