discourse/plugins/chat/spec/system/drawer/index_spec.rb

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

62 lines
1.4 KiB
Ruby
Raw Normal View History

# frozen_string_literal: true
RSpec.describe "Drawer - index", type: :system do
fab!(:current_user) { Fabricate(:user) }
let(:drawer_page) { PageObjects::Pages::ChatDrawer.new }
before do
chat_system_bootstrap
sign_in(current_user)
end
it "can leave a direct message" do
channel = Fabricate(:direct_message_channel, users: [current_user])
row = PageObjects::Components::Chat::ChannelRow.new(channel.id)
drawer_page.visit_index
drawer_page.click_direct_messages
expect(row).to exist
row.leave
expect(row).to be_non_existent
end
it "can leave a group message" do
channel =
Fabricate(
:direct_message_channel,
group: true,
users: [current_user, Fabricate(:user), Fabricate(:user)],
)
row = PageObjects::Components::Chat::ChannelRow.new(channel.id)
drawer_page.visit_index
drawer_page.click_direct_messages
expect(row).to exist
row.leave
expect(row).to be_non_existent
end
it "can open browse" do
channel = Fabricate(:chat_channel)
drawer_page.visit_index
drawer_page.channels_index.open_browse
expect(drawer_page.browse).to have_channel(name: channel.name)
end
DEV: rename chat preferred mobile index to chat preferred index (#27953) * DEV: rename chat preferred mobile index to chat preferred index * UX: change routing to be consistent with mobile * DEV: change migration file to use script * UX: show footer only if more than one option is available * UX: Remove desktopView only checks for chat * DEV: Remove unused imports * UX: Update chat footer checks and Add rerouting to chat drawer * UX: Add margin to chat row in desktop and update chat drawer logic * UX: Change chat in desktop to use flexbox * UX: Add drawer actions to chat navbar * DEV: Update page object with new chat css classes removed `.open-browse-page-btn` usage in 7bd65006d760886b261f0587fafe28443bf2d3ec * DEV: rename `browse/open` in chat url to `channels` * UX: Adjust css for when in threads mode * DEV: change css class name in no_sidebar_spec.rb * DEV: rename tests to be more descriptive with the action they are testing update chat template to not rely on `:has` * DEV: update test and add method to chat page object * DEV: update no_sidebar_spec for chat changes * DEV: remove tests from navigation_spec that no longer apply * DEV: revert typo in test * DEV: change url path for mobile chat in test specs * DEV: Add check for when is desktop in rerouting * UX: Removed footer from desktop. Made `hasThreads` and `hasDirectMessages` methods in chat-drawer public * UX: remove sidebar on desktop full page if dm list is empty * DEV: Address review comments * DEV: Adjust reroute logic for chat browse remove unused code * UX: Adjust rerouting to go to browse.open * UX: Change rerouting to be more consistent Add chat_default_channel_id routing * UX: Update rerouting configuration for chat routes * DEV: Update tests with the new chat behavior * DEV: revert changes made in tests and bring back toggle for drawer * DEV: revert classes in page objects * DEV: Add tests to new chat navigation behavior remove unused stylesheets revert deleted lines in tests update concat class logic in chat dm template * DEV: update css on test
2024-07-30 21:25:22 +08:00
it "shows empty state when no dms" do
drawer_page.visit_index
drawer_page.click_direct_messages
expect(page).to have_css("#c-footer-direct-messages.--active")
expect(page).to have_selector(".channel-list-empty-message")
end
end