mirror of
https://gh.wpcy.net/https://github.com/discourse/discourse.git
synced 2026-05-05 07:13:12 +08:00
This makes the helpful flags link clickable like the others, and adjusts styling a bit to improve the roundness and spacing Before: <img width="325" alt="image" src="https://github.com/user-attachments/assets/09c9f474-333b-4afe-9ad9-1164773412ce" /> After: <img width="345" alt="image" src="https://github.com/user-attachments/assets/824d3624-184c-4469-a8a3-69a54251ecb8" />
94 lines
2.5 KiB
Ruby
94 lines
2.5 KiB
Ruby
# frozen_string_literal: true
|
|
|
|
module PageObjects
|
|
module Pages
|
|
class User < PageObjects::Pages::Base
|
|
def visit(user)
|
|
page.visit("/u/#{user.username}")
|
|
self
|
|
end
|
|
|
|
def find(selector)
|
|
page.find(".new-user-wrapper #{selector}")
|
|
end
|
|
|
|
def active_user_primary_navigation
|
|
find(".user-navigation-primary li a.active")
|
|
end
|
|
|
|
def active_user_secondary_navigation
|
|
find(".user-navigation-secondary li a.active")
|
|
end
|
|
|
|
def has_warning_messages_path?(user)
|
|
page.has_current_path?("/u/#{user.username}/messages/warnings")
|
|
end
|
|
|
|
def has_primary_navigation_item?(name)
|
|
page.has_css?(primary_navigation_selector(name))
|
|
end
|
|
|
|
def has_no_primary_navigation_item?(name)
|
|
page.has_no_css?(primary_navigation_selector(name))
|
|
end
|
|
|
|
def has_secondary_navigation_item?(name)
|
|
page.has_css?(secondary_navigation_selector(name))
|
|
end
|
|
|
|
def has_no_secondary_navigation_item?(name)
|
|
page.has_no_css?(secondary_navigation_selector(name))
|
|
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 click_staff_info_silencings_link
|
|
staff_counters = page.find(".staff-counters")
|
|
staff_counters.find("a:has(.silencings)").click
|
|
self
|
|
end
|
|
|
|
def click_staff_info_flags_link
|
|
page.find(".staff-counters .flags").click
|
|
self
|
|
end
|
|
|
|
def has_staff_counter_flags?(count:)
|
|
page.has_css?(".staff-counters .flags", text: count.to_s)
|
|
end
|
|
|
|
def click_staff_info_flags_given_link
|
|
page.find(".staff-counters .helpful-flags").click
|
|
self
|
|
end
|
|
|
|
def has_staff_counter_flags_given?(count:)
|
|
page.has_css?(".staff-counters .helpful-flags", text: count.to_s)
|
|
end
|
|
|
|
def expand_info_panel
|
|
button = page.find("button[aria-controls='collapsed-info-panel']")
|
|
button.click if button["aria-expanded"] == "false"
|
|
self
|
|
end
|
|
|
|
def click_primary_navigation_item(name)
|
|
page.find(primary_navigation_selector(name)).click
|
|
end
|
|
|
|
private
|
|
|
|
def primary_navigation_selector(name)
|
|
".new-user-wrapper .user-navigation-primary li.user-nav__#{name}"
|
|
end
|
|
|
|
def secondary_navigation_selector(name)
|
|
".new-user-wrapper .user-navigation-secondary li.user-nav__#{name}"
|
|
end
|
|
end
|
|
end
|
|
end
|