From 5346e7f6931aee8a9b96f8820e4123f331f7a532 Mon Sep 17 00:00:00 2001 From: Joffrey JAFFEUX Date: Wed, 26 Jul 2023 11:58:35 +0200 Subject: [PATCH] FIX: attempt to fix multi sessions reaction spec (#22797) I was only able to get one failure out of 100 tries, this failure didn't get me more info. My best guess ATM is that sometimes, the first session was still loading while receiving the reaction and created some unexpected situation. The commit attempts to start the "check" session before the session making the reaction hoping that will be enough to prevent this case, if this is the issue. --- plugins/chat/spec/system/react_to_message_spec.rb | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) diff --git a/plugins/chat/spec/system/react_to_message_spec.rb b/plugins/chat/spec/system/react_to_message_spec.rb index d675cca5b0e..b4e56b92d07 100644 --- a/plugins/chat/spec/system/react_to_message_spec.rb +++ b/plugins/chat/spec/system/react_to_message_spec.rb @@ -71,26 +71,27 @@ RSpec.describe "React to message", type: :system do context "when current user has multiple sessions" do it "adds reaction on each session" do - reaction = OpenStruct.new(emoji: "grimacing") + reaction = "grimacing" + + sign_in(current_user) + chat.visit_channel(category_channel_1) using_session(:tab_1) do sign_in(current_user) chat.visit_channel(category_channel_1) end - sign_in(current_user) - chat.visit_channel(category_channel_1) - using_session(:tab_1) do |session| channel.hover_message(message_1) find(".chat-message-react-btn").click - find(".chat-emoji-picker [data-emoji=\"#{reaction.emoji}\"]").click + find(".chat-emoji-picker [data-emoji=\"#{reaction}\"]").click + + expect(channel).to have_reaction(message_1, reaction) - expect(channel).to have_reaction(message_1, reaction.emoji) session.quit end - expect(channel).to have_reaction(message_1, reaction.emoji) + expect(channel).to have_reaction(message_1, "grimacing") end end end