discourse/spec/system/page_objects/components/welcome_banner.rb
Yuriy Kurant f74a4385a0
DEV: select-kit autoFilterable improvements (#36241)
As a follow-up of #36218.

* decrease a threshold number from `>15` to `>=10` for filter to render
* add const `FILTER_VISIBILITY_THRESHOLD` as a single source of truth
for controlling when filter should be shown
* changes hardcoded threshold with imported
`FILTER_VISIBILITY_THRESHOLD` in combo-box
* consolidate usage of `visible: true` in specs
2025-11-26 16:18:42 +08:00

87 lines
2.4 KiB
Ruby
Vendored

# frozen_string_literal: true
module PageObjects
module Components
class WelcomeBanner < PageObjects::Components::Base
def visible?
has_css?(".welcome-banner")
end
def hidden?
has_no_css?(".welcome-banner")
end
def invisible?
has_css?(".welcome-banner", visible: false)
end
def has_anonymous_title?
has_css?(
".welcome-banner .welcome-banner__title",
text: I18n.t("js.welcome_banner.header.anonymous_members", site_name: SiteSetting.title),
)
end
def has_logged_in_title?(username)
has_css?(
".welcome-banner .welcome-banner__title",
text:
I18n.t("js.welcome_banner.header.logged_in_members", preferred_display_name: username),
)
end
def has_new_user_title?(username)
has_css?(
".welcome-banner .welcome-banner__title",
text: I18n.t("js.welcome_banner.header.new_members", preferred_display_name: username),
)
end
def has_no_subheader?
has_no_css?(".welcome-banner .welcome-banner__subheader")
end
def has_anonymous_subheader?
has_css?(
".welcome-banner .welcome-banner__subheader",
text: I18n.t("js.welcome_banner.subheader.anonymous_members"),
)
end
def has_logged_in_subheader?
has_css?(
".welcome-banner .welcome-banner__subheader",
text: I18n.t("js.welcome_banner.subheader.logged_in_members"),
)
end
def has_no_bg_img?
has_no_css?(".welcome-banner.--with-bg-img")
end
def has_bg_img?(url)
has_css?(
".welcome-banner.--with-bg-img .custom-search-banner-wrap.welcome-banner__wrap",
style: "background-image:url(#{url});",
visible: true,
)
end
def has_custom_text_color?(color)
has_css?(".welcome-banner .welcome-banner__title", style: "color:#{color};", visible: true)
end
def has_no_custom_text_color?(color)
has_no_css?(".welcome-banner .welcome-banner__title", style: "color:#{color};")
end
def above_topic_content?
has_css?("#main-outlet > .--location-above-topic-content", visible: true)
end
def below_site_header?
has_css?(".discourse-root > .--location-below-site-header", visible: true)
end
end
end
end