mirror of
https://github.com/Sendouc/sendou.ink.git
synced 2026-05-07 13:52:47 -05:00
* Got something going * Style overwrites * width != height * More playing with lines * Migrations * Start bracket initial * Unhardcode stage generation params * Link to match page * Matches page initial * Support directly adding seed to map list generator * Add docs * Maps in matches page * Add invariant about tie breaker map pool * Fix PICNIC lacking tie breaker maps * Only link in bracket when tournament has started * Styled tournament roster inputs * Prefer IGN in tournament match page * ModeProgressIndicator * Some conditional rendering * Match action initial + better error display * Persist bestOf in DB * Resolve best of ahead of time * Move brackets-manager to core * Score reporting works * Clear winner on score report * ModeProgressIndicator: highlight winners * Fix inconsistent input * Better text when submitting match * mapCountPlayedInSetWithCertainty that works * UNDO_REPORT_SCORE implemented * Permission check when starting tournament * Remove IGN from upsert * View match results page * Source in DB * Match page waiting for teams * Move tournament bracket to feature folder * REOPEN_MATCH initial * Handle proper resetting of match * Inline bracket-manager * Syncify * Transactions * Handle match is locked gracefully * Match page auto refresh * Fix match refresh called "globally" * Bracket autoupdate * Move fillWithNullTillPowerOfTwo to utils with testing * Fix map lists not visible after tournament started * Optimize match events * Show UI while in progress to members * Fix start tournament alert not being responsive * Teams can check in * Fix map list 400 * xxx -> TODO * Seeds page * Remove map icons for team page * Don't display link to seeds after tournament has started * Admin actions initial * Change captain admin action * Make all hooks ts * Admin actions functioning * Fix validate error not displaying in CatchBoundary * Adjust validate args order * Remove admin loader * Make delete team button menancing * Only include checked in teams to bracket * Optimize to.id route loads * Working show map list generator toggle * Update full tournaments flow * Make full tournaments work with many start times * Handle undefined in crud * Dynamic stage banner * Handle default strat if map list generation fails * Fix crash on brackets if less than 2 teams * Add commented out test for reference * Add TODO * Add players from team during register * TrustRelationship * Prefers not to host feature * Last before merge * Rename some vars * More renames
91 lines
2.2 KiB
TypeScript
91 lines
2.2 KiB
TypeScript
import { expect, type Locator, type Page } from "@playwright/test";
|
|
import type { SeedVariation } from "~/routes/seed";
|
|
|
|
export async function selectWeapon({
|
|
page,
|
|
name,
|
|
inputName = "weapon",
|
|
}: {
|
|
page: Page;
|
|
name: string;
|
|
inputName?: string;
|
|
}) {
|
|
return selectComboboxValue({ page, value: name, inputName });
|
|
}
|
|
|
|
export async function selectUser({
|
|
page,
|
|
userName,
|
|
labelName,
|
|
}: {
|
|
page: Page;
|
|
userName: string;
|
|
labelName: string;
|
|
}) {
|
|
const combobox = page.getByLabel(labelName);
|
|
await expect(combobox).not.toBeDisabled();
|
|
|
|
await combobox.clear();
|
|
await combobox.type(userName);
|
|
await page.keyboard.press("Enter");
|
|
}
|
|
|
|
export async function selectComboboxValue({
|
|
page,
|
|
value,
|
|
inputName,
|
|
locator,
|
|
}: {
|
|
page: Page;
|
|
value: string;
|
|
inputName?: string;
|
|
locator?: Locator;
|
|
}) {
|
|
if (!locator && !inputName) {
|
|
throw new Error("Must provide either locator or inputName");
|
|
}
|
|
const combobox = locator ?? page.getByTestId(`${inputName!}-combobox-input`);
|
|
await combobox.clear();
|
|
await combobox.fill(value);
|
|
await combobox.press("Enter");
|
|
}
|
|
|
|
/** page.goto that waits for the page to be hydrated before proceeding */
|
|
export async function navigate({ page, url }: { page: Page; url: string }) {
|
|
await page.goto(url);
|
|
await expect(page.getByTestId("hydrated")).toHaveCount(1);
|
|
}
|
|
|
|
export function seed(page: Page, variation?: SeedVariation) {
|
|
return page.request.post("/seed", {
|
|
form: { variation: variation ?? "DEFAULT" },
|
|
});
|
|
}
|
|
|
|
export function impersonate(page: Page, userId = 1) {
|
|
return page.request.post(`/auth/impersonate?id=${userId}`);
|
|
}
|
|
|
|
export async function submit(page: Page) {
|
|
const responsePromise = page.waitForResponse(
|
|
(res) => res.request().method() === "POST"
|
|
);
|
|
await page.getByTestId("submit-button").click();
|
|
await responsePromise;
|
|
}
|
|
|
|
export function isNotVisible(locator: Locator) {
|
|
return expect(locator).toHaveCount(0);
|
|
}
|
|
|
|
export function modalClickConfirmButton(page: Page) {
|
|
return page.getByTestId("confirm-button").click();
|
|
}
|
|
|
|
export async function fetchSendouInk<T>(url: string) {
|
|
const res = await fetch(`http://localhost:5800${url}`);
|
|
if (!res.ok) throw new Error("Response not successful");
|
|
|
|
return res.json() as T;
|
|
}
|