User report
reports a user from the card and shows it on the admin page
Renders/lfg/u/:identifier/u/:identifier/admin
Arrange
Create 3 × user → [reporter, ...earlierReporters]
const [reporter, ...earlierReporters] =
await factories.UserFactory.createMany(3);
For each earlierReporter of earlierReporters
for (const earlierReporter of earlierReporters) {
await factories.UserReportFactory.create(
{
reporterUserId: earlierReporter.id,
reportedUserId: NZAP_TEST_ID,
},
{ createdAt: subDays(new Date(), 1) },
);
}Create user report reporter user id earlierReporter.id reported N-ZAP created at subDays(new Date(), 1)
await factories.UserReportFactory.create(
{
reporterUserId: earlierReporter.id,
reportedUserId: NZAP_TEST_ID,
},
{ createdAt: subDays(new Date(), 1) },
);
Create LFG post author N-ZAP
await factories.LFGPostFactory.create({ authorId: NZAP_TEST_ID });
LFG page Act
Open the LFG page
await lfg.goto();
Open user card “N-ZAP” → card
const card = await lfg.openUserCard("N-ZAP");Open report dialog → reportDialog
const reportDialog = await card.openReportDialog();
description = "Called my team mean names in the match chat"
const description = "Called my team mean names in the match chat";
Select “HARASSMENT” for category
await reportDialog.form.select("category", "HARASSMENT");Fill description with description
await reportDialog.form.fill("description", description);Send
await reportDialog.send();
Assert
reportDialog.locators.sentToast is in the page
await expect(reportDialog.locators.sentToast).toBeAttached();
User admin page Act
Open the user admin page N-ZAP
await adminPage.goto(NZAP_TEST_ID);
Assert
total reports text 3 is visible
await expect(adminPage.totalReportsText(3)).toBeVisible();
report details count is 3
await expect(adminPage.locators.reportDetails).toHaveCount(3);
text description is not visible
await expect(adminPage.text(description)).not.toBeVisible();
Act
Open first report
await adminPage.openFirstReport();
Assert
text description is visible
await expect(adminPage.text(description)).toBeVisible();
Source
test("reports a user from the card and shows it on the admin page", async ({
page,
factories,
}) => {
const [reporter, ...earlierReporters] =
await factories.UserFactory.createMany(3);
for (const earlierReporter of earlierReporters) {
await factories.UserReportFactory.create(
{
reporterUserId: earlierReporter.id,
reportedUserId: NZAP_TEST_ID,
},
{ createdAt: subDays(new Date(), 1) },
);
}
await factories.LFGPostFactory.create({ authorId: NZAP_TEST_ID });
await impersonate(page, reporter.id);
const lfg = new LFGPage(page);
await lfg.goto();
const card = await lfg.openUserCard("N-ZAP");
const reportDialog = await card.openReportDialog();
const description = "Called my team mean names in the match chat";
await reportDialog.form.select("category", "HARASSMENT");
await reportDialog.form.fill("description", description);
await reportDialog.send();
await expect(reportDialog.locators.sentToast).toBeAttached();
await impersonate(page);
const adminPage = new UserAdminPage(page);
await adminPage.goto(NZAP_TEST_ID);
await expect(adminPage.totalReportsText(3)).toBeVisible();
await expect(adminPage.locators.reportDetails).toHaveCount(3);
await expect(adminPage.text(description)).not.toBeVisible();
await adminPage.openFirstReport();
await expect(adminPage.text(description)).toBeVisible();
})points elsewhere instead of reporting an inappropriate nickname
Renders/lfg
Arrange
Create user → reporter
const reporter = await factories.UserFactory.create();
Create LFG post author N-ZAP
await factories.LFGPostFactory.create({ authorId: NZAP_TEST_ID });
LFG page Act
Open the LFG page
await lfg.goto();
Open user card “N-ZAP” → card
const card = await lfg.openUserCard("N-ZAP");Open report dialog → reportDialog
const reportDialog = await card.openReportDialog();
Assert
reportDialog.locators.submitButton is visible
await expect(reportDialog.locators.submitButton).toBeVisible();
Act
Select “INAPPROPRIATE_NICKNAME” for category
await reportDialog.form.select("category", "INAPPROPRIATE_NICKNAME");
Assert
reportDialog.locators.nicknameInstructions is visible
await expect(reportDialog.locators.nicknameInstructions).toBeVisible();
reportDialog.locators.submitButton is not visible
await expect(reportDialog.locators.submitButton).not.toBeVisible();
Source
test("points elsewhere instead of reporting an inappropriate nickname", async ({
page,
factories,
}) => {
const reporter = await factories.UserFactory.create();
await factories.LFGPostFactory.create({ authorId: NZAP_TEST_ID });
await impersonate(page, reporter.id);
const lfg = new LFGPage(page);
await lfg.goto();
const card = await lfg.openUserCard("N-ZAP");
const reportDialog = await card.openReportDialog();
await expect(reportDialog.locators.submitButton).toBeVisible();
await reportDialog.form.select("category", "INAPPROPRIATE_NICKNAME");
await expect(reportDialog.locators.nicknameInstructions).toBeVisible();
await expect(reportDialog.locators.submitButton).not.toBeVisible();
})prefills the match id when reporting from a match page
Renders/q/match/:id
Arrange
Create 3 × user → alphaMates
const alphaMates = await factories.UserFactory.createMany(3);
Create 3 × user → bravoMates
const bravoMates = await factories.UserFactory.createMany(3);
Create SQ match alpha user ids Sendou, ...alphaMates.map((user) => user.id) bravo user ids N-ZAP, ...bravoMates.map((user) => user.id) → match
const match = await factories.SQMatchFactory.create({
alphaUserIds: [ADMIN_ID, ...alphaMates.map((user) => user.id)],
bravoUserIds: [NZAP_TEST_ID, ...bravoMates.map((user) => user.id)],
});
SendouQ match page Act
Open the SendouQ match page match.id, “rosters”
await matchPage.goto(match.id, "rosters");
Open user card /N-ZAP/ → card
const card = await matchPage.openUserCard(/N-ZAP/);
Open report dialog → reportDialog
const reportDialog = await card.openReportDialog();
Assert
reportDialog.locators.matchIdInput has value String(match.id)
await expect(reportDialog.locators.matchIdInput).toHaveValue(
String(match.id),
);
Source
test("prefills the match id when reporting from a match page", async ({
page,
factories,
}) => {
const alphaMates = await factories.UserFactory.createMany(3);
const bravoMates = await factories.UserFactory.createMany(3);
const match = await factories.SQMatchFactory.create({
alphaUserIds: [ADMIN_ID, ...alphaMates.map((user) => user.id)],
bravoUserIds: [NZAP_TEST_ID, ...bravoMates.map((user) => user.id)],
});
await impersonate(page);
const matchPage = new SendouQMatchPage(page);
await matchPage.goto(match.id, "rosters");
const card = await matchPage.openUserCard(/N-ZAP/);
const reportDialog = await card.openReportDialog();
await expect(reportDialog.locators.matchIdInput).toHaveValue(
String(match.id),
);
})LFGPage.gotoe2e/pages/lfg/lfg-page.ts:23
No JSDoc
async goto() {
await navigate({ page: this.page, url: LFG_PAGE });
}LFGPage.openUserCarde2e/pages/lfg/lfg-page.ts:36
No JSDoc
openUserCard(name: string) {
return UserCard.open(
this.page,
this.page.getByRole("button", { name }).first(),
);
}UserAdminPage.gotoe2e/pages/user/user-admin-page.ts:19
No JSDoc
async goto(userId: number) {
await navigate({ page: this.page, url: userAdminPage({ id: userId }) });
}UserAdminPage.totalReportsTexte2e/pages/user/user-admin-page.ts:23
No JSDoc
totalReportsText(count: number) {
return this.page.getByText(`${count} total`);
}UserAdminPage.locators.reportDetailse2e/pages/user/user-admin-page.ts:15
No JSDoc
reportsList.locator("details")UserAdminPage.texte2e/pages/user/user-admin-page.ts:27
No JSDoc
text(content: string) {
return this.page.getByText(content);
}UserAdminPage.openFirstReporte2e/pages/user/user-admin-page.ts:31
No JSDoc
async openFirstReport() {
await this.locators.reportsList.locator("summary").first().click();
}LFGPagee2e/pages/lfg/lfg-page.ts:8
No JSDoc
UserAdminPagee2e/pages/user/user-admin-page.ts:6
SendouQMatchPage.gotoe2e/pages/sendouq/sendouq-match-page.ts:70
No JSDoc
async goto(matchId: number, tab: Tab = "action") {
await navigate({
page: this.page,
url: `${sendouQMatchPage(matchId)}?tab=${tab}`,
});
}SendouQMatchPage.openUserCarde2e/pages/sendouq/sendouq-match-page.ts:110
No JSDoc
openUserCard(name: string | RegExp) {
return UserCard.open(
this.page,
this.page.getByRole("button", { name }).first(),
);
}SendouQMatchPagee2e/pages/sendouq/sendouq-match-page.ts:33
No JSDoc