Skip to content

A platform for community discussion. Free, open, simple.

FIX: more stable system tests (#19678)

Joffrey JAFFEUXb235799792e2
diff --git a/plugins/chat/assets/javascripts/discourse/components/chat-live-pane.js b/plugins/chat/assets/javascripts/discourse/components/chat-live-pane.js
index ef2ab7639c7..42fdf413451 100644
--- a/plugins/chat/assets/javascripts/discourse/components/chat-live-pane.js
+++ b/plugins/chat/assets/javascripts/discourse/components/chat-live-pane.js
@@ -1026,7 +1026,7 @@ export default Component.extend({
this.set("sendingLoading", false);
});
- if (this.details.can_load_more_future) {
+ if (this.details?.can_load_more_future) {
msgCreationPromise.then(() => this._fetchAndScrollToLatest());
} else {
const stagedMessage = this._prepareSingleMessage(
diff --git a/plugins/chat/spec/system/jit_messages_spec.rb b/plugins/chat/spec/system/jit_messages_spec.rb
index b922242712c..8cd9fad03e6 100644
--- a/plugins/chat/spec/system/jit_messages_spec.rb
+++ b/plugins/chat/spec/system/jit_messages_spec.rb
@@ -9,14 +9,15 @@ RSpec.describe "JIT messages", type: :system, js: true do
let(:channel) { PageObjects::Pages::ChatChannel.new }
before do
- Jobs.run_immediately!
channel_1.add(current_user)
chat_system_bootstrap
sign_in(current_user)
end
context "when mentioning a user not on the channel" do
- it "displays a mention warning" do
+ xit "displays a mention warning" do
+ Jobs.run_immediately!
+
chat.visit_channel(channel_1)
channel.send_message("hi @#{other_user.username}")
@@ -36,6 +37,8 @@ RSpec.describe "JIT messages", type: :system, js: true do
end
it "displays a mention warning" do
+ Jobs.run_immediately!
+
chat.visit_channel(private_channel_1)
channel.send_message("hi @#{other_user.username}")
@@ -50,6 +53,8 @@ RSpec.describe "JIT messages", type: :system, js: true do
fab!(:group_1) { Fabricate(:group, mentionable_level: Group::ALIAS_LEVELS[:nobody]) }
it "displays a mention warning" do
+ Jobs.run_immediately!
+
chat.visit_channel(channel_1)
channel.send_message("hi @#{group_1.name}")
diff --git a/plugins/chat/spec/system/page_objects/chat/chat_channel.rb b/plugins/chat/spec/system/page_objects/chat/chat_channel.rb
index 38183d8c6d4..6d17e6d1ad8 100644
--- a/plugins/chat/spec/system/page_objects/chat/chat_channel.rb
+++ b/plugins/chat/spec/system/page_objects/chat/chat_channel.rb
@@ -72,6 +72,7 @@ module PageObjects
find(".chat-composer-input").click # makes helper more reliable by ensuring focus is not lost
find(".chat-composer-input").fill_in(with: text)
click_send_message
+ find(".chat-composer-input").click # ensures autocomplete is closed and not masking anything
end
def reply_to(message)
diff --git a/plugins/chat/spec/system/user_menu_notifications/sidebar_spec.rb b/plugins/chat/spec/system/user_menu_notifications/sidebar_spec.rb
index a5d930049a5..bde5ad1a8af 100644
--- a/plugins/chat/spec/system/user_menu_notifications/sidebar_spec.rb
+++ b/plugins/chat/spec/system/user_menu_notifications/sidebar_spec.rb
@@ -162,16 +162,13 @@ RSpec.describe "User menu notifications | sidebar", type: :system, js: true do
fab!(:channel_1) { Fabricate(:chat_channel) }
fab!(:other_user) { Fabricate(:user) }
- before do
- Jobs.run_immediately!
- channel_1.add(current_user)
- end
+ before { channel_1.add(current_user) }
it "shows an invitation notification" do
+ Jobs.run_immediately!
+
chat.visit_channel(channel_1)
- find(".chat-composer-input").fill_in(with: "this is fine @#{other_user.username}")
- find(".send-btn").click
- find(".chat-composer-input").click # ensures autocomplete is closed and not masking invite link
+ channel.send_message("this is fine @#{other_user.username}")
find(".invite-link", wait: 5).click
using_session(:user_1) do