mirror of
https://github.com/discourse/discourse.git
synced 2025-02-25 18:55:32 -06:00
FIX: more stable system tests (#19678)
This commit is a series of fixes to improve stability of system tests following the use of threadsafe: * Jobs.run_immediately in before block was causing issues * During test a js error could be caused by an undefined this.details in chat-live-pane * Apply the chat composer click trick everywhere when sending a message, it ensures we are not hiding anything with autocomplete * There was another case not using send_message yet
This commit is contained in:
parent
431b129d8b
commit
b235799792
@ -1026,7 +1026,7 @@ export default Component.extend({
|
|||||||
this.set("sendingLoading", false);
|
this.set("sendingLoading", false);
|
||||||
});
|
});
|
||||||
|
|
||||||
if (this.details.can_load_more_future) {
|
if (this.details?.can_load_more_future) {
|
||||||
msgCreationPromise.then(() => this._fetchAndScrollToLatest());
|
msgCreationPromise.then(() => this._fetchAndScrollToLatest());
|
||||||
} else {
|
} else {
|
||||||
const stagedMessage = this._prepareSingleMessage(
|
const stagedMessage = this._prepareSingleMessage(
|
||||||
|
@ -9,14 +9,15 @@ RSpec.describe "JIT messages", type: :system, js: true do
|
|||||||
let(:channel) { PageObjects::Pages::ChatChannel.new }
|
let(:channel) { PageObjects::Pages::ChatChannel.new }
|
||||||
|
|
||||||
before do
|
before do
|
||||||
Jobs.run_immediately!
|
|
||||||
channel_1.add(current_user)
|
channel_1.add(current_user)
|
||||||
chat_system_bootstrap
|
chat_system_bootstrap
|
||||||
sign_in(current_user)
|
sign_in(current_user)
|
||||||
end
|
end
|
||||||
|
|
||||||
context "when mentioning a user not on the channel" do
|
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)
|
chat.visit_channel(channel_1)
|
||||||
channel.send_message("hi @#{other_user.username}")
|
channel.send_message("hi @#{other_user.username}")
|
||||||
|
|
||||||
@ -36,6 +37,8 @@ RSpec.describe "JIT messages", type: :system, js: true do
|
|||||||
end
|
end
|
||||||
|
|
||||||
it "displays a mention warning" do
|
it "displays a mention warning" do
|
||||||
|
Jobs.run_immediately!
|
||||||
|
|
||||||
chat.visit_channel(private_channel_1)
|
chat.visit_channel(private_channel_1)
|
||||||
channel.send_message("hi @#{other_user.username}")
|
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]) }
|
fab!(:group_1) { Fabricate(:group, mentionable_level: Group::ALIAS_LEVELS[:nobody]) }
|
||||||
|
|
||||||
it "displays a mention warning" do
|
it "displays a mention warning" do
|
||||||
|
Jobs.run_immediately!
|
||||||
|
|
||||||
chat.visit_channel(channel_1)
|
chat.visit_channel(channel_1)
|
||||||
channel.send_message("hi @#{group_1.name}")
|
channel.send_message("hi @#{group_1.name}")
|
||||||
|
|
||||||
|
@ -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").click # makes helper more reliable by ensuring focus is not lost
|
||||||
find(".chat-composer-input").fill_in(with: text)
|
find(".chat-composer-input").fill_in(with: text)
|
||||||
click_send_message
|
click_send_message
|
||||||
|
find(".chat-composer-input").click # ensures autocomplete is closed and not masking anything
|
||||||
end
|
end
|
||||||
|
|
||||||
def reply_to(message)
|
def reply_to(message)
|
||||||
|
@ -162,16 +162,13 @@ RSpec.describe "User menu notifications | sidebar", type: :system, js: true do
|
|||||||
fab!(:channel_1) { Fabricate(:chat_channel) }
|
fab!(:channel_1) { Fabricate(:chat_channel) }
|
||||||
fab!(:other_user) { Fabricate(:user) }
|
fab!(:other_user) { Fabricate(:user) }
|
||||||
|
|
||||||
before do
|
before { channel_1.add(current_user) }
|
||||||
Jobs.run_immediately!
|
|
||||||
channel_1.add(current_user)
|
|
||||||
end
|
|
||||||
|
|
||||||
it "shows an invitation notification" do
|
it "shows an invitation notification" do
|
||||||
|
Jobs.run_immediately!
|
||||||
|
|
||||||
chat.visit_channel(channel_1)
|
chat.visit_channel(channel_1)
|
||||||
find(".chat-composer-input").fill_in(with: "this is fine @#{other_user.username}")
|
channel.send_message("this is fine @#{other_user.username}")
|
||||||
find(".send-btn").click
|
|
||||||
find(".chat-composer-input").click # ensures autocomplete is closed and not masking invite link
|
|
||||||
find(".invite-link", wait: 5).click
|
find(".invite-link", wait: 5).click
|
||||||
|
|
||||||
using_session(:user_1) do
|
using_session(:user_1) do
|
||||||
|
Loading…
Reference in New Issue
Block a user