mirror of
https://github.com/discourse/discourse.git
synced 2024-11-30 06:04:09 +08:00
41f8bff2c3
Why this change? It is very unlikely that we need to ever JS for system tests considering that we rely on a JS framework on the frontend.
51 lines
1.4 KiB
Ruby
51 lines
1.4 KiB
Ruby
# frozen_string_literal: true
|
|
|
|
RSpec.describe "Shortcuts | sidebar", type: :system do
|
|
fab!(:current_user) { Fabricate(:admin) }
|
|
|
|
let(:chat) { PageObjects::Pages::Chat.new }
|
|
|
|
before do
|
|
SiteSetting.navigation_menu = "sidebar"
|
|
chat_system_bootstrap
|
|
sign_in(current_user)
|
|
end
|
|
|
|
context "when using Up/Down arrows" do
|
|
fab!(:channel_1) { Fabricate(:chat_channel) }
|
|
fab!(:dm_channel_1) { Fabricate(:direct_message_channel, users: [current_user]) }
|
|
|
|
before { channel_1.add(current_user) }
|
|
|
|
context "when on homepage" do
|
|
it "does nothing" do
|
|
visit("/")
|
|
find("body").send_keys(%i[alt arrow_down])
|
|
|
|
expect(page).to have_no_selector(".channel-#{channel_1.id}.active")
|
|
expect(page).to have_no_selector(".channel-#{dm_channel_1.id}.active")
|
|
end
|
|
end
|
|
|
|
context "when on chat page" do
|
|
it "navigates through the channels" do
|
|
chat.visit_channel(channel_1)
|
|
|
|
expect(page).to have_selector(".channel-#{channel_1.id}.active")
|
|
|
|
find("body").send_keys(%i[alt arrow_down])
|
|
|
|
expect(page).to have_selector(".channel-#{dm_channel_1.id}.active")
|
|
|
|
find("body").send_keys(%i[alt arrow_down])
|
|
|
|
expect(page).to have_selector(".channel-#{channel_1.id}.active")
|
|
|
|
find("body").send_keys(%i[alt arrow_up])
|
|
|
|
expect(page).to have_selector(".channel-#{dm_channel_1.id}.active")
|
|
end
|
|
end
|
|
end
|
|
end
|