mirror of
https://github.com/discourse/discourse.git
synced 2024-12-30 08:04:53 +08:00
5d657c8c41
Adding the directory item test causes the default test to fail randomly due to directory items not getting removed properly. Removing this for now, and also moving this test to the common system folder instead of system/user_page
63 lines
1.5 KiB
Ruby
63 lines
1.5 KiB
Ruby
# frozen_string_literal: true
|
|
|
|
describe "Users directory", type: :system do
|
|
fab!(:user)
|
|
let!(:initial_directory_events) { [] }
|
|
|
|
before { Array.new(DirectoryItemsController::PAGE_SIZE + 10) { Fabricate(:user) } }
|
|
|
|
describe "shows a table of users" do
|
|
it "renders successfully for a logged-in user" do
|
|
DirectoryItem.refresh!
|
|
sign_in(user)
|
|
|
|
visit("/u")
|
|
|
|
expect(page).to have_css(".users-directory")
|
|
expect(page).not_to have_css(".spinner")
|
|
header_texts =
|
|
page
|
|
.all(".directory-table__column-header .header-contents")
|
|
.map { |element| element.text.strip }
|
|
|
|
expect(header_texts).to eq(
|
|
[
|
|
"Username",
|
|
"Received",
|
|
"Given",
|
|
"Topics Created",
|
|
"Replies Posted",
|
|
"Topics Viewed",
|
|
"Posts Read",
|
|
"Days Visited",
|
|
],
|
|
)
|
|
end
|
|
|
|
it "renders successfully for an anonymous user" do
|
|
DirectoryItem.refresh!
|
|
visit("/u")
|
|
|
|
expect(page).to have_css(".users-directory")
|
|
expect(page).not_to have_css(".spinner")
|
|
header_texts =
|
|
page
|
|
.all(".directory-table__column-header .header-contents")
|
|
.map { |element| element.text.strip }
|
|
|
|
expect(header_texts).to eq(
|
|
[
|
|
"Username",
|
|
"Received",
|
|
"Given",
|
|
"Topics Created",
|
|
"Replies Posted",
|
|
"Topics Viewed",
|
|
"Posts Read",
|
|
"Days Visited",
|
|
],
|
|
)
|
|
end
|
|
end
|
|
end
|