discourse/spec/system/page_objects/pages/user.rb

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

41 lines
1.0 KiB
Ruby
Raw Normal View History

2022-11-11 17:44:40 +08:00
# frozen_string_literal: true
module PageObjects
module Pages
class User < PageObjects::Pages::Base
def visit(user)
page.visit("/u/#{user.username}")
self
end
2022-11-11 17:44:40 +08:00
def find(selector)
page.find(".new-user-wrapper #{selector}")
2022-11-11 17:44:40 +08:00
end
def active_user_primary_navigation
find(".user-navigation-primary li a.active")
2022-11-11 17:44:40 +08:00
end
def active_user_secondary_navigation
find(".user-navigation-secondary li a.active")
2022-11-11 17:44:40 +08:00
end
def has_warning_messages_path?(user)
page.has_current_path?("/u/#{user.username}/messages/warnings")
end
def click_staff_info_warnings_link(user, warnings_count: 0)
staff_counters = page.find(".staff-counters")
staff_counters.find("a[href='/u/#{user.username}/messages/warnings']").click
self
end
def expand_info_panel
button = page.find("button[aria-controls='collapsed-info-panel']")
button.click if button["aria-expanded"] == "false"
self
end
2022-11-11 17:44:40 +08:00
end
end
end