discourse/spec/system/user_page/users_directory_spec.rb
Natalie Tay 5d657c8c41
DEV: Remove flaky test for now (#29249)
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
2024-10-17 16:58:35 +08:00

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