sendou.ink/e2e/scrims.spec.ts
Kalle b4cc185d1d
Some checks are pending
Tests and checks on push / run-checks-and-tests (push) Waiting to run
Updates translation progress / update-translation-progress-issue (push) Waiting to run
Scrims (#2211)
* Initial

* Progress

* Initial UI

* Can submit request

* Progress

* Show text if no scrims

* Can cancel request, tabs

* Delete post

* Popover if can't delete

* Request rows

* Progress

* Scrim page initial

* Fix migration order

* Progress

* Progress

* Works again

* Make it compile

* Make it compile again

* Work

* Progress

* Progress

* Progress

* Associations initial

* Association visibility work

* notFoundVisibility form fields initial

* Progress

* Association leave/join + reset invite code

* Progress

* Select test

* Merge branch 'rewrite' into scrims

* Remeda for groupBy

* Select with search

* Outline styling for select

* Select done?

* Fix prop names

* Paginated badges

* Less important

* Select no results

* Handle limiting select width

* UserSearch non-working

* Fix problem from merge

* Remove UserSearch for now

* Remove todo

* Flaggable

* Remove TODOs

* i18n start + styling

* Progress

* i18n done

* Add association e2e test

* E2E tests

* Done?

* Couple leftovers
2025-04-20 22:51:23 +03:00

96 lines
2.3 KiB
TypeScript

import test, { expect } from "@playwright/test";
import { ADMIN_ID } from "~/constants";
import {
impersonate,
navigate,
seed,
selectUser,
submit,
} from "~/utils/playwright";
import { scrimsPage } from "~/utils/urls";
test.describe("Scrims", () => {
test("creates a new scrim & deletes it", async ({ page }) => {
await seed(page);
await impersonate(page, ADMIN_ID);
await navigate({
page,
url: "/",
});
await page.getByTestId("anything-adder-menu-button").click();
await page.getByTestId("menu-item-scrimPost").click();
await page.getByLabel("With").selectOption("PICKUP");
await selectUser({
labelName: "User 2",
page,
userName: "N-ZAP",
});
await selectUser({
labelName: "User 3",
page,
userName: "ab",
});
await selectUser({
labelName: "User 4",
page,
userName: "de",
});
await page.getByLabel("Visibility").selectOption("2");
await page.getByLabel("Text").fill("Test scrim");
await submit(page);
await expect(page.getByTestId("limited-visibility-popover")).toBeVisible();
await page.getByRole("button", { name: "Delete" }).first().click();
await page.getByTestId("confirm-button").click();
await expect(page.getByRole("button", { name: "Delete" })).toHaveCount(1);
});
test("requests an existing scrim post & cancels the request", async ({
page,
}) => {
await seed(page);
await impersonate(page, ADMIN_ID);
await navigate({
page,
url: scrimsPage(),
});
await page.getByTestId("tab-Available").click();
await page.getByRole("button", { name: "Request" }).first().click();
await submit(page);
await page.getByTestId("tab-Requests").click();
const cancelRequestButton = page.getByRole("button", {
name: "Cancel",
});
expect(cancelRequestButton).toHaveCount(5);
await cancelRequestButton.first().click();
await page.getByTestId("confirm-button").click();
await expect(cancelRequestButton).toHaveCount(4);
});
test("accepts a request", async ({ page }) => {
await seed(page);
await impersonate(page, ADMIN_ID);
await navigate({
page,
url: scrimsPage(),
});
await page.getByRole("button", { name: "Accept" }).first().click();
await page.getByTestId("confirm-button").click();
await page.getByRole("link", { name: "Contact" }).click();
await expect(page.getByText("Scheduled scrim")).toBeVisible();
});
});