discourse/plugins/chat/spec/system/channel_info_pages_spec.rb
Roman Rizzi d07b472b79
DEV: /channel -> /c chat route rename (#19782)
* DEV: Rnemae channel path to just c

Also swap the channel id and channel slug params to be consistent with core.

* linting

* channel_path

* params in wrong order

* Drop slugify helper and channel route without slug

* Request slug and route models through the channel model if possible

* Add client side redirection for backwards-compatibility

Co-authored-by: Joffrey JAFFEUX <j.jaffeux@gmail.com>
2023-01-27 09:58:12 -03:00

39 lines
1.1 KiB
Ruby

# frozen_string_literal: true
RSpec.describe "Info pages", type: :system, js: true do
let(:chat_page) { PageObjects::Pages::Chat.new }
let(:channel) { PageObjects::Pages::ChatChannel.new }
fab!(:current_user) { Fabricate(:user) }
fab!(:channel_1) { Fabricate(:chat_channel) }
before do
chat_system_bootstrap
sign_in(current_user)
channel_1.add(current_user)
end
context "when visiting from browse page" do
context "when clicking back button" do
it "redirects to browse page" do
chat_page.visit_browse
find(".chat-channel-card__setting").click
find(".chat-full-page-header__back-btn").click
expect(page).to have_current_path("/chat/browse/open")
end
end
end
context "when visiting from channel page" do
context "when clicking back button" do
it "redirects to channel page" do
chat_page.visit_channel(channel_1)
find(".chat-channel-title-wrapper").click
find(".chat-full-page-header__back-btn").click
expect(page).to have_current_path(chat.channel_path(channel_1.slug, channel_1.id))
end
end
end
end