sendou.ink/app/utils/playwright.ts
Kalle 30063f6075
VoDs (#1283)
* YouTube lite embed + CSS bundled import

* Migration initial

* New VoD page initial functioning

* Table changes + add TODOs

* New structure for add vod page

* WIP add new VoD backend

* Merge branch 'rewrite' of https://github.com/Sendouc/sendou.ink into vods

* Fix when leaderboard appears

* Function new vod form

* Single vod page initial

* Different YouTubeEmbed

* Scroll to top when going to timestamp

* Vod match weapon/mode icons

* Vod page user

* Add date to vod page

* Adjust migration order

* Vod page many weapons

* Add title to vod page

* New vods page cast many weapons

* Add player index to order by

* Vods new more validation

* Vod listing page initial

* Vods page with filters

* Show message if no vods

* Fix not being to unset filters

* Fix seed sometimes throwing errors

* User page VoDs

* Vods nullable weapon combobox

* Link directly to user custom url from vod page

* Make video adder admin action

* Can add video checks

* i18n

* New VoD form tests

* VoD operates filters test

* Vods behind flag

* Remove from config
2023-02-26 14:31:57 +02:00

43 lines
1.1 KiB
TypeScript

import { expect, type Locator, type Page } from "@playwright/test";
export async function selectWeapon({
page,
name,
inputName = "weapon",
}: {
page: Page;
name: string;
inputName?: string;
}) {
const weaponCombobox = page.getByTestId(`${inputName}-combobox-input`);
await weaponCombobox.clear();
await weaponCombobox.fill(name);
await weaponCombobox.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) {
return page.request.post("/seed");
}
export function impersonate(page: Page, userId = 1) {
return page.request.post(`/auth/impersonate?id=${userId}`);
}
export function submit(page: Page) {
return page.getByTestId("submit-button").click();
}
export function isNotVisible(locator: Locator) {
return expect(locator).toHaveCount(0);
}
export function modalClickConfirmButton(page: Page) {
return page.getByTestId("confirm-button").click();
}