mirror of
https://github.com/Sendouc/sendou.ink.git
synced 2026-09-28 06:10:01 -05:00
33 lines
657 B
TypeScript
33 lines
657 B
TypeScript
import type { Page } from "@playwright/test";
|
|
|
|
type AddableItem =
|
|
| "art"
|
|
| "association"
|
|
| "builds"
|
|
| "calendarEvent"
|
|
| "lfgPost"
|
|
| "organization"
|
|
| "plus"
|
|
| "scrimPost"
|
|
| "team"
|
|
| "tournament"
|
|
| "vods";
|
|
|
|
/** The "Add new…" menu of the site layout, available on every page. */
|
|
export class AnythingAdder {
|
|
private readonly page: Page;
|
|
readonly locators;
|
|
|
|
constructor(page: Page) {
|
|
this.page = page;
|
|
this.locators = {
|
|
menuButton: page.getByTestId("anything-adder-menu-button").first(),
|
|
};
|
|
}
|
|
|
|
async add(item: AddableItem) {
|
|
await this.locators.menuButton.click();
|
|
await this.page.getByTestId(`menu-item-${item}`).click();
|
|
}
|
|
}
|