mirror of
https://github.com/Sendouc/sendou.ink.git
synced 2026-03-21 18:04:39 -05:00
78 lines
1.9 KiB
TypeScript
78 lines
1.9 KiB
TypeScript
import { NZAP_TEST_ID } from "~/db/seed/constants";
|
|
import { ADMIN_ID } from "~/features/admin/admin-constants";
|
|
import {
|
|
expect,
|
|
impersonate,
|
|
isNotVisible,
|
|
navigate,
|
|
seed,
|
|
submit,
|
|
test,
|
|
} from "~/utils/playwright";
|
|
import { associationsPage, scrimsPage } from "~/utils/urls";
|
|
|
|
test.describe("Associations", () => {
|
|
test("creates a new association", async ({ page }) => {
|
|
await seed(page);
|
|
await impersonate(page, NZAP_TEST_ID);
|
|
await navigate({
|
|
page,
|
|
url: "/",
|
|
});
|
|
|
|
await page.getByTestId("anything-adder-menu-button").first().click();
|
|
await page.getByTestId("menu-item-association").click();
|
|
|
|
await page.getByLabel("Name").fill("My Association");
|
|
await submit(page);
|
|
|
|
await expect(
|
|
page.getByRole("heading").filter({ hasText: "My Association" }),
|
|
).toBeVisible();
|
|
});
|
|
|
|
test("deletes an association", async ({ page }) => {
|
|
await seed(page);
|
|
await impersonate(page, ADMIN_ID);
|
|
await navigate({
|
|
page,
|
|
url: scrimsPage(),
|
|
});
|
|
await page.getByRole("link", { name: "Associations" }).click();
|
|
|
|
await expect(page.getByTestId("delete-association")).toHaveCount(2);
|
|
|
|
await page.getByTestId("delete-association").first().click();
|
|
await submit(page, "confirm-button");
|
|
|
|
await expect(page.getByTestId("delete-association")).toHaveCount(1);
|
|
});
|
|
|
|
test("joins and leaves an association", async ({ page }) => {
|
|
await seed(page);
|
|
await impersonate(page, ADMIN_ID);
|
|
await navigate({
|
|
page,
|
|
url: associationsPage(),
|
|
});
|
|
|
|
const inviteLink = await page
|
|
.getByLabel("Share link to add members")
|
|
.first()
|
|
.inputValue();
|
|
|
|
await impersonate(page, NZAP_TEST_ID);
|
|
await navigate({
|
|
page,
|
|
url: inviteLink.replace("https://sendou.ink", "http://localhost:6173"),
|
|
});
|
|
|
|
await submit(page);
|
|
|
|
await page.getByTestId("leave-team-button").click();
|
|
await submit(page, "confirm-button");
|
|
|
|
await isNotVisible(page.getByTestId("leave-team-button"));
|
|
});
|
|
});
|