2022-11-11 04:44:40 -05:00
|
|
|
# frozen_string_literal: true
|
|
|
|
|
|
|
|
module PageObjects
|
|
|
|
module Pages
|
|
|
|
class User < PageObjects::Pages::Base
|
2022-12-13 18:14:01 -05:00
|
|
|
def visit(user)
|
|
|
|
page.visit("/u/#{user.username}")
|
|
|
|
self
|
|
|
|
end
|
|
|
|
|
2022-11-11 04:44:40 -05:00
|
|
|
def find(selector)
|
2023-02-20 21:16:16 -05:00
|
|
|
page.find(".new-user-wrapper #{selector}")
|
2022-11-11 04:44:40 -05:00
|
|
|
end
|
|
|
|
|
|
|
|
def active_user_primary_navigation
|
2023-02-20 21:16:16 -05:00
|
|
|
find(".user-navigation-primary li a.active")
|
2022-11-11 04:44:40 -05:00
|
|
|
end
|
|
|
|
|
|
|
|
def active_user_secondary_navigation
|
2023-02-20 21:16:16 -05:00
|
|
|
find(".user-navigation-secondary li a.active")
|
2022-11-11 04:44:40 -05:00
|
|
|
end
|
2022-12-13 18:14:01 -05:00
|
|
|
|
|
|
|
def has_warning_messages_path?(user)
|
|
|
|
page.has_current_path?("/u/#{user.username}/messages/warnings")
|
|
|
|
end
|
|
|
|
|
|
|
|
def click_staff_info_warnings_link(warnings_count: 0)
|
|
|
|
staff_counters = page.find(".staff-counters")
|
|
|
|
staff_counters.click_link(
|
|
|
|
"#{warnings_count} #{I18n.t("js.user.staff_counters.warnings_received")}",
|
|
|
|
)
|
|
|
|
self
|
|
|
|
end
|
2022-11-11 04:44:40 -05:00
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|