A platform for community discussion. Free, open, simple.
FIX: new chat from url flaky fix (#27414)
David Battersbyfb11ab5895a5
diff --git a/plugins/chat/spec/system/chat_new_message_spec.rb b/plugins/chat/spec/system/chat_new_message_spec.rbindex 41301c65537..2a5f4fb7fbb 100644--- a/plugins/chat/spec/system/chat_new_message_spec.rb+++ b/plugins/chat/spec/system/chat_new_message_spec.rb@@ -14,6 +14,10 @@ RSpec.describe "Chat New Message from params", type: :system dosign_in(current_user)end+ def group_slug(users)+ users.pluck(:username).permutation.map { |u| u.join("-") }.join("|")+ end+context "with a single user" doit "redirects to existing chat channel" dochat_page.visit_new_message(user_1)@@ -42,9 +46,10 @@ RSpec.describe "Chat New Message from params", type: :system doit "loads existing dm channel when one exists" doexpect { chat_page.visit_new_message([user_1, user_2]) }.not_to change { Chat::Channel.count }- users = [user_1.username, user_2.username].permutation.map { |u| u.join("-") }.join("|")- expect(page).to have_current_path(%r{/chat/c/(#{users})/#{group_dm.id}})+ expect(page).to have_current_path(+ %r{/chat/c/(#{group_slug([user_1, user_2])})/#{group_dm.id}},+ )endit "creates a dm channel when none exists" do@@ -53,7 +58,7 @@ RSpec.describe "Chat New Message from params", type: :system do)expect(page).to have_current_path(- "/chat/c/#{user_1.username}-#{user_3.username}/#{Chat::Channel.last.id}",+ %r{/chat/c/#{group_slug([user_1, user_3])}/#{Chat::Channel.last.id}},)end