0
0
Fork 0
mirror of https://github.com/discourse/discourse.git synced 2026-08-08 17:53:55 +08:00
discourse/spec/system/page_objects/pages/admin_users.rb
Kris 1b559b6bc5
UX: improve admin filters, add to users and permalinks (#42029)
This makes some consistency improvements to our `DFilterControls`
component and applies it to the admin/users and admin/config/permalinks
pages


Before:
<img width="2250" height="592" alt="image"
src="https://github.com/user-attachments/assets/23eafb7a-948c-4414-93f0-a906ffedb714"
/>


After: 
<img width="2190" height="648" alt="image"
src="https://github.com/user-attachments/assets/e9cb4545-5b3a-4bd1-87ac-140113cee033"
/>


Before:
<img width="2234" height="886" alt="image"
src="https://github.com/user-attachments/assets/efc51dac-4f95-4731-8c83-5285ba5e2528"
/>


After:
<img width="2298" height="872" alt="image"
src="https://github.com/user-attachments/assets/d6434f44-311a-48cb-aeb6-b34fba7b9f05"
/>


Before:
<img width="2258" height="894" alt="image"
src="https://github.com/user-attachments/assets/95972f51-b306-4c27-93ad-2a7c6c66080a"
/>


After:
<img width="2236" height="932" alt="image"
src="https://github.com/user-attachments/assets/9cbfd319-e0ce-4bb5-97ea-c9e09c91dcf9"
/>
2026-07-24 17:04:26 -04:00

113 lines
2.7 KiB
Ruby
Vendored

# frozen_string_literal: true
module PageObjects
module Pages
class AdminUsers < AdminBase
class UserRow
attr_reader :element
def initialize(element)
@element = element
end
def bulk_select_checkbox
element.find(".directory-table__cell-bulk-select")
end
def has_bulk_select_checkbox?
element.has_css?(".directory-table__cell-bulk-select")
end
def has_no_bulk_select_checkbox?
element.has_no_css?(".directory-table__cell-bulk-select")
end
def username
element.find("a[href^='/admin/users']")
end
end
def visit
page.visit("/admin/users/list/active")
end
def bulk_select_button
find(".btn.bulk-select")
end
def bulk_select_all_button
find(".btn.bulk-select-all")
end
def bulk_clear_all_button
find(".btn.bulk-clear-all")
end
def search_input
find(".d-filter-controls__input")
end
def user_row(id)
UserRow.new(find(".directory-table__row[data-user-id=\"#{id}\"]"))
end
def users_count
all(".directory-table__row").size
end
def has_correct_breadcrumbs?
expect(all(".d-breadcrumbs__item").map(&:text)).to eq(
[I18n.t("js.admin_title"), I18n.t("admin_js.admin.users.title")],
)
end
def has_users?(user_ids)
user_ids.all? { |id| has_css?(".directory-table__row[data-user-id=\"#{id}\"]") }
end
def has_no_users?(user_ids)
user_ids.all? { |id| has_no_css?(".directory-table__row[data-user-id=\"#{id}\"]") }
end
def bulk_actions_dropdown
PageObjects::Components::DMenu.new(find(".bulk-select-admin-users-dropdown-trigger"))
end
def has_bulk_actions_dropdown?
has_css?(".bulk-select-admin-users-dropdown-trigger")
end
def has_no_bulk_actions_dropdown?
has_no_css?(".bulk-select-admin-users-dropdown-trigger")
end
def has_usernames?(usernames)
expect(all(".directory-table__cell.username").map(&:text)).to eq(usernames)
end
def has_none_users?
has_content?(I18n.t("js.search.no_results"))
end
def has_no_emails?
has_no_css?(".directory-table__column-header--email")
end
def has_emails?
has_css?(".directory-table__column-header--email")
end
def click_show_emails
find(".admin-users__subheader-show-emails").click
end
def click_send_invites
find(".admin-users__header-send-invites").click
end
def click_export
find(".admin-users__header-export-users").click
end
end
end
end