discourse/spec/system/page_objects/components/d_menu.rb
Osama Sayegh ad0966afa9
FEATURE: Introduce new components listing page (#32164)
Follow-up to https://github.com/discourse/discourse/pull/31887

This commit introduces a new design for the components listing page, which
is not linked from anywhere in the UI at the moment, but it can be
accessed by heading to the `/admin/config/customize/components` path
directly. We'll make this new design available from the sidebar and
remove the old page once we've tested and validated the new design
internally.

Internal topic: t/146007.

---------

Co-authored-by: Ella <ella.estigoy@gmail.com>
2025-04-08 17:58:29 +03:00

47 lines
998 B
Ruby

# frozen_string_literal: true
module PageObjects
module Components
class DMenu < PageObjects::Components::Base
attr_reader :component
def initialize(input)
if input.is_a?(Capybara::Node::Element)
@component = input
else
@component = find(input)
end
end
def expand
raise "DMenu is already expanded" if is_expanded?
component.click
end
def collapse
raise "DMenu is already collapsed" if is_collapsed?
component.click
end
def is_expanded?
component["aria-expanded"] == "true"
end
def is_collapsed?
!is_expanded?
end
def option(selector)
within("#d-menu-portals") { find(selector) }
end
def has_option?(selector)
within("#d-menu-portals") { has_css?(selector) }
end
def has_no_option?(selector)
within("#d-menu-portals") { has_no_css?(selector) }
end
end
end
end