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
|
|
|
|
|
2023-04-12 05:13:37 -04:00
|
|
|
def click_staff_info_warnings_link(user, warnings_count: 0)
|
2022-12-13 18:14:01 -05:00
|
|
|
staff_counters = page.find(".staff-counters")
|
2023-04-12 05:13:37 -04:00
|
|
|
staff_counters.find("a[href='/u/#{user.username}/messages/warnings']").click
|
2022-12-13 18:14:01 -05:00
|
|
|
self
|
|
|
|
end
|
2022-11-11 04:44:40 -05:00
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|