DEV: attempts to move all Jobs.run_immediately! at top (#19688)

This commit is contained in:
Joffrey JAFFEUX 2023-01-03 11:32:27 +01:00 committed by GitHub
parent f04e454628
commit a5dac26769
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
7 changed files with 63 additions and 36 deletions

View File

@ -53,9 +53,9 @@ RSpec.describe "Archive channel", type: :system, js: true do
end
context "when archiving" do
# before { Jobs.run_immediately! }
it "works" do
Jobs.run_immediately!
xit "works" do
chat.visit_channel_settings(channel_1)
click_button(I18n.t("js.chat.channel_settings.archive_channel"))
find("#split-topic-name").fill_in(with: "An interesting topic for cats")
@ -66,18 +66,19 @@ RSpec.describe "Archive channel", type: :system, js: true do
end
context "when archived channels had unreads" do
before do
before { channel_1.add(current_user) }
it "clears unread indicators" do
Jobs.run_immediately!
other_user = Fabricate(:user)
channel_1.add(other_user)
channel_1.add(current_user)
Chat::ChatMessageCreator.create(
chat_channel: channel_1,
user: other_user,
content: "this is fine @#{current_user.username}",
)
end
xit "clears unread indicators" do
visit("/")
expect(page.find(".chat-channel-unread-indicator")).to have_content(1)
@ -92,10 +93,7 @@ RSpec.describe "Archive channel", type: :system, js: true do
end
context "when archiving failed" do
before do
# Jobs.run_immediately!
channel_1.update!(status: :read_only)
end
before { channel_1.update!(status: :read_only) }
fab!(:archive) do
ChatChannelArchive.create!(
@ -108,7 +106,9 @@ RSpec.describe "Archive channel", type: :system, js: true do
)
end
xit "can be retried" do
it "can be retried" do
Jobs.run_immediately!
chat.visit_channel(channel_1)
click_button(I18n.t("js.chat.channel_archive.retry"))

View File

@ -37,13 +37,13 @@ RSpec.describe "Channel - Info - Members page", type: :system, js: true do
channel_1.add(current_user)
channel_1.add(Fabricate(:user, username: "cat"))
98.times { channel_1.add(Fabricate(:user)) }
channel_1.update!(user_count_stale: true)
# Jobs.run_immediately!
Jobs::UpdateChannelUserCount.new.execute(chat_channel_id: channel_1.id)
end
xit "shows all members" do
it "shows all members" do
Jobs.run_immediately!
channel_1.update!(user_count_stale: true)
Jobs::UpdateChannelUserCount.new.execute(chat_channel_id: channel_1.id)
chat_page.visit_channel_members(channel_1)
expect(page).to have_selector(".channel-members-view__list-item", count: 50)
@ -58,7 +58,11 @@ RSpec.describe "Channel - Info - Members page", type: :system, js: true do
end
context "with filter" do
xit "filters members" do
it "filters members" do
Jobs.run_immediately!
channel_1.update!(user_count_stale: true)
Jobs::UpdateChannelUserCount.new.execute(chat_channel_id: channel_1.id)
chat_page.visit_channel_members(channel_1)
find(".channel-members-view__search-input").fill_in(with: "cat")

View File

@ -15,7 +15,7 @@ RSpec.describe "JIT messages", type: :system, js: true do
end
context "when mentioning a user not on the channel" do
xit "displays a mention warning" do
it "displays a mention warning" do
Jobs.run_immediately!
chat.visit_channel(channel_1)
@ -36,7 +36,7 @@ RSpec.describe "JIT messages", type: :system, js: true do
private_channel_1.add(current_user)
end
xit "displays a mention warning" do
it "displays a mention warning" do
Jobs.run_immediately!
chat.visit_channel(private_channel_1)
@ -52,7 +52,7 @@ RSpec.describe "JIT messages", type: :system, js: true do
context "when group can't be mentioned" do
fab!(:group_1) { Fabricate(:group, mentionable_level: Group::ALIAS_LEVELS[:nobody]) }
xit "displays a mention warning" do
it "displays a mention warning" do
Jobs.run_immediately!
chat.visit_channel(channel_1)

View File

@ -32,6 +32,8 @@ RSpec.describe "Message notifications - mobile", type: :system, js: true, mobile
context "when not member of the channel" do
context "when a message is created" do
it "doesn't show anything" do
Jobs.run_immediately!
visit("/chat")
using_session(:user_1) { create_message(channel: channel_1, creator: user_1) }
@ -48,7 +50,6 @@ RSpec.describe "Message notifications - mobile", type: :system, js: true, mobile
context "when user is in DnD" do
before do
# Jobs.run_immediately!
Fabricate(
:do_not_disturb_timing,
user: current_user,
@ -57,7 +58,9 @@ RSpec.describe "Message notifications - mobile", type: :system, js: true, mobile
)
end
xit "doesnt show indicator in header" do
it "doesnt show indicator in header" do
Jobs.run_immediately!
visit("/chat")
using_session(:user_1) { create_message(channel: channel_1, creator: user_1) }
@ -70,7 +73,9 @@ RSpec.describe "Message notifications - mobile", type: :system, js: true, mobile
before { channel_1.membership_for(current_user).update!(muted: true) }
context "when a message is created" do
xit "doesn't show anything" do
it "doesn't show anything" do
Jobs.run_immediately!
visit("/chat")
using_session(:user_1) { create_message(channel: channel_1, creator: user_1) }
@ -84,6 +89,8 @@ RSpec.describe "Message notifications - mobile", type: :system, js: true, mobile
context "when a message is created" do
it "correctly renders notifications" do
Jobs.run_immediately!
visit("/chat")
using_session(:user_1) { create_message(channel: channel_1, creator: user_1) }
@ -97,6 +104,8 @@ RSpec.describe "Message notifications - mobile", type: :system, js: true, mobile
context "when a message with mentions is created" do
it "correctly renders notifications" do
Jobs.run_immediately!
visit("/chat")
using_session(:user_1) do
create_message(
@ -126,6 +135,8 @@ RSpec.describe "Message notifications - mobile", type: :system, js: true, mobile
context "when a message is created" do
it "correctly renders notifications" do
Jobs.run_immediately!
visit("/chat")
using_session(:user_1) { create_message(channel: dm_channel_1, creator: user_1) }
@ -134,12 +145,14 @@ RSpec.describe "Message notifications - mobile", type: :system, js: true, mobile
".chat-channel-row[data-chat-channel-id=\"#{dm_channel_1.id}\"] .chat-channel-unread-indicator",
)
using_session(:user_1) { create_message(channel: dm_channel_1, creator: user_1) }
using_session(:user_1) { create_message(channel: dm_channel_1, creator: user_1) }
expect(page).to have_css(".chat-header-icon .chat-channel-unread-indicator", text: "2")
end
it "reorders channels" do
Jobs.run_immediately!
visit("/chat")
expect(page).to have_css(
@ -174,6 +187,8 @@ RSpec.describe "Message notifications - mobile", type: :system, js: true, mobile
context "when messages are created" do
it "correctly renders notifications" do
Jobs.run_immediately!
visit("/chat")
using_session(:user_1) { create_message(channel: channel_1, creator: user_1) }

View File

@ -46,7 +46,6 @@ RSpec.describe "Message notifications - with sidebar", type: :system, js: true d
context "when user is in DnD" do
before do
# Jobs.run_immediately!
Fabricate(
:do_not_disturb_timing,
user: current_user,
@ -55,7 +54,9 @@ RSpec.describe "Message notifications - with sidebar", type: :system, js: true d
)
end
xit "doesnt show indicator in header" do
it "doesnt show indicator in header" do
Jobs.run_immediately!
visit("/")
using_session(:user_1) { create_message(channel: channel_1, creator: user_1) }
@ -89,9 +90,9 @@ RSpec.describe "Message notifications - with sidebar", type: :system, js: true d
end
context "when a message with mentions is created" do
# before { Jobs.run_immediately! }
it "correctly renders notifications" do
Jobs.run_immediately!
xit "correctly renders notifications" do
visit("/")
using_session(:user_1) do
create_message(

View File

@ -39,10 +39,10 @@ RSpec.describe "User menu notifications | sidebar", type: :system, js: true do
context "when dm channel" do
fab!(:dm_channel_1) { Fabricate(:direct_message_channel, users: [current_user, other_user]) }
# before { Jobs.run_immediately! }
context "when @username" do
xit "shows a mention notification" do
it "shows a mention notification" do
Jobs.run_immediately!
message =
Chat::ChatMessageCreator.create(
chat_channel: dm_channel_1,
@ -106,7 +106,9 @@ RSpec.describe "User menu notifications | sidebar", type: :system, js: true do
end
context "when @username" do
xit "shows a mention notification" do
it "shows a mention notification" do
Jobs.run_immediately!
message =
Chat::ChatMessageCreator.create(
chat_channel: channel_1,

View File

@ -13,10 +13,11 @@ RSpec.describe "User status | sidebar", type: :system, js: true do
chat_system_bootstrap
current_user.set_status!("online", "heart")
sign_in(current_user)
# Jobs.run_immediately!
end
xit "shows user status" do
it "shows user status" do
Jobs.run_immediately!
visit("/")
expect(find(".user-status .emoji")["title"]).to eq("online")
@ -24,7 +25,9 @@ RSpec.describe "User status | sidebar", type: :system, js: true do
end
context "when changing status" do
xit "updates status" do
it "updates status" do
Jobs.run_immediately!
visit("/")
current_user.set_status!("offline", "tooth")
@ -34,7 +37,9 @@ RSpec.describe "User status | sidebar", type: :system, js: true do
end
context "when removing status" do
xit "removes status" do
it "removes status" do
Jobs.run_immediately!
visit("/")
current_user.clear_status!