Skip to content
Source
Sign inSign up
samwillis/one-million-boxes
Open History to see the last commit

helpers.ts

16 lines587 Bytes

1import { expect } from "@playwright/test"
2import type { Page } from "@playwright/test"
3​
4export async function openGame(page: Page) {
5 await page.goto("/")
6 await expect(page.getByTestId("game-canvas")).toBeVisible({ timeout: 30000 })
7 const play = page.getByRole("button", { name: /team, Play!/ })
8 const dismissed = await page.evaluate(
9 () => sessionStorage.getItem("boxes:about-dismissed") === "true",
10 )
11 if (!dismissed) {
12 await expect(play).toBeVisible()
13 await play.click()
14 }
15 await expect(page.getByTestId("connection-status")).toBeHidden({ timeout: 30000 })