mirror of
https://github.com/discourse/discourse.git
synced 2024-12-02 08:03:44 +08:00
5dbf812d32
This commit continues on work laid out by 6039b513fe
to redesign the /about page. In this commit, we add the site age and a section on the right hand side to show site activities/statistics such as topics, posts, sign-ups, likes etc.
61 lines
1.8 KiB
Ruby
61 lines
1.8 KiB
Ruby
# frozen_string_literal: true
|
|
|
|
module PageObjects
|
|
module Pages
|
|
class About < PageObjects::Pages::Base
|
|
def visit
|
|
page.visit("/about")
|
|
end
|
|
|
|
def has_header_title?(title)
|
|
has_css?(".about__header h3", text: title)
|
|
end
|
|
|
|
def has_short_description?(content)
|
|
has_css?(".about__header .short-description", text: content)
|
|
end
|
|
|
|
def has_banner_image?(upload)
|
|
has_css?("img.about__banner[src=\"#{GlobalPath.full_cdn_url(upload.url)}\"]")
|
|
end
|
|
|
|
def has_members_count?(count, formatted_number)
|
|
element = find(".about__stats-item.members span")
|
|
element.has_text?(I18n.t("js.about.member_count", count:, formatted_number:))
|
|
end
|
|
|
|
def has_admins_count?(count, formatted_number)
|
|
element = find(".about__stats-item.admins span")
|
|
element.has_text?(I18n.t("js.about.admin_count", count:, formatted_number:))
|
|
end
|
|
|
|
def has_moderators_count?(count, formatted_number)
|
|
element = find(".about__stats-item.moderators span")
|
|
element.has_text?(I18n.t("js.about.moderator_count", count:, formatted_number:))
|
|
end
|
|
|
|
def has_site_created_less_than_1_month_ago?
|
|
site_age_stat_element.has_text?(I18n.t("js.about.site_age.less_than_one_month"))
|
|
end
|
|
|
|
def has_site_created_in_months_ago?(months)
|
|
site_age_stat_element.has_text?(I18n.t("js.about.site_age.month", count: months))
|
|
end
|
|
|
|
def has_site_created_in_years_ago?(years)
|
|
site_age_stat_element.has_text?(I18n.t("js.about.site_age.year", count: years))
|
|
end
|
|
|
|
def site_activities
|
|
PageObjects::Components::AboutPageSiteActivity.new(find(".about__activities"))
|
|
end
|
|
|
|
private
|
|
|
|
def site_age_stat_element
|
|
find(".about__stats-item.site-creation-date span")
|
|
end
|
|
end
|
|
end
|
|
end
|