2023-02-23 15:01:39 +08:00
|
|
|
# frozen_string_literal: true
|
|
|
|
|
2023-06-07 09:26:58 +08:00
|
|
|
describe "Viewing sidebar mobile", type: :system, mobile: true do
|
2023-11-10 06:47:59 +08:00
|
|
|
fab!(:user)
|
2023-02-23 15:01:39 +08:00
|
|
|
let(:sidebar_dropdown) { PageObjects::Components::SidebarHeaderDropdown.new }
|
|
|
|
let(:composer) { PageObjects::Components::Composer.new }
|
|
|
|
|
|
|
|
before { sign_in(user) }
|
|
|
|
|
|
|
|
it "does not display the sidebar by default" do
|
|
|
|
visit("/latest")
|
|
|
|
|
|
|
|
expect(sidebar_dropdown).to be_hidden
|
|
|
|
end
|
|
|
|
|
|
|
|
it "does not display the keyboard shortcuts button" do
|
|
|
|
visit("/latest")
|
|
|
|
|
|
|
|
sidebar_dropdown.click
|
|
|
|
|
|
|
|
expect(sidebar_dropdown).to be_visible
|
|
|
|
expect(sidebar_dropdown).to have_no_keyboard_shortcuts_button
|
|
|
|
end
|
|
|
|
|
|
|
|
it "collapses the sidebar when clicking outside of it" do
|
|
|
|
visit("/latest")
|
|
|
|
|
|
|
|
sidebar_dropdown.click
|
|
|
|
|
|
|
|
expect(sidebar_dropdown).to be_visible
|
|
|
|
|
|
|
|
sidebar_dropdown.click_outside
|
|
|
|
|
|
|
|
expect(sidebar_dropdown).to be_hidden
|
|
|
|
end
|
|
|
|
|
2023-06-14 04:02:21 +08:00
|
|
|
it "collapses the sidebar when clicking on a link in the sidebar" do
|
2023-02-23 15:01:39 +08:00
|
|
|
visit("/latest")
|
|
|
|
|
|
|
|
sidebar_dropdown.click
|
|
|
|
|
|
|
|
expect(sidebar_dropdown).to be_visible
|
|
|
|
|
2023-06-15 09:36:38 +08:00
|
|
|
sidebar_dropdown.click_topics_link
|
2023-02-23 15:01:39 +08:00
|
|
|
|
|
|
|
expect(sidebar_dropdown).to be_hidden
|
|
|
|
end
|
|
|
|
|
|
|
|
it "collapses the sidebar when clicking on a button in the sidebar" do
|
|
|
|
visit("/latest")
|
|
|
|
|
|
|
|
sidebar_dropdown.click
|
|
|
|
|
|
|
|
expect(sidebar_dropdown).to be_visible
|
|
|
|
|
2023-07-11 09:40:37 +08:00
|
|
|
sidebar_dropdown.click_categories_header_button
|
2023-02-23 15:01:39 +08:00
|
|
|
|
|
|
|
expect(sidebar_dropdown).to be_hidden
|
|
|
|
end
|
|
|
|
|
|
|
|
it "toggles to desktop view after clicking on the toggle to desktop view button" do
|
2023-12-07 06:25:00 +08:00
|
|
|
visit("/latest")
|
2023-02-23 15:01:39 +08:00
|
|
|
|
|
|
|
expect(page).to have_css(".mobile-view")
|
|
|
|
|
|
|
|
sidebar_dropdown.click
|
|
|
|
sidebar_dropdown.click_toggle_to_desktop_view_button
|
|
|
|
|
2023-12-07 06:25:00 +08:00
|
|
|
visit("/latest")
|
2023-02-23 15:01:39 +08:00
|
|
|
|
|
|
|
expect(page).to have_css(".desktop-view")
|
|
|
|
end
|
|
|
|
end
|