FIX: handles starting draft dm from sidebar (#18946)

This commit is contained in:
Joffrey JAFFEUX
2022-11-08 23:58:11 +01:00
committed by GitHub
parent f8f55cef67
commit 074aa5eb5e
4 changed files with 54 additions and 20 deletions

View File

@ -8,6 +8,7 @@ RSpec.describe "Navigation", type: :system, js: true do
fab!(:category_channel) { Fabricate(:category_channel) }
fab!(:message) { Fabricate(:chat_message, chat_channel: category_channel) }
let(:chat_page) { PageObjects::Pages::Chat.new }
let(:sidebar_page) { PageObjects::Pages::Sidebar.new }
before do
# ensures we have one valid registered admin
@ -125,5 +126,28 @@ RSpec.describe "Navigation", type: :system, js: true do
)
end
end
context "when starting draft from sidebar with drawer preferred" do
it "opens draft in drawer" do
visit("/")
sidebar_page.start_draft_dm
expect(page).to have_current_path("/")
expect(page).to have_css(".topic-chat-container.expanded.visible")
end
end
context "when starting draft from sidebar with full page preferred" do
it "opens draft in full page" do
visit("/")
chat_page.open_from_header
chat_page.maximize_drawer
visit("/")
sidebar_page.start_draft_dm
expect(page).to have_current_path("/chat/draft-channel")
expect(page).not_to have_css(".topic-chat-container.expanded.visible")
end
end
end
end