Files
discourse/spec/system/page_objects/components/welcome_banner.rb
Martin Brennan 64f1b97e0c FEATURE: Add welcome banner to core (#31516)
This is a stripped-back version of the Search Banner
component https://meta.discourse.org/t/search-banner/122939,
which will be renamed to Advanced Search Banner,
see https://github.com/discourse/discourse-search-banner/pull/84.

This welcome banner interacts with the header search.
When `search_experience` is set to `search_field`, we only
show the header search after the welcome banner scrolls
out of view, and vice-versa.

Only new sites will get this feature turned on by default,
existing sites have a migration to disable it.

---------

Co-authored-by: Joffrey JAFFEUX <j.jaffeux@gmail.com>
Co-authored-by: Jordan Vidrine <jordan@jordanvidrine.com>
2025-03-17 12:18:08 +10:00

35 lines
831 B
Ruby

# 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
end
end
end