Files
Rosea/e2e/garden.ts
T

22 lines
1.0 KiB
TypeScript

import { expect, type Page } from '@playwright/test';
import { en } from '@rosea/ui/copy';
/**
* The first open asks *Who tends her?* (planet-garden.md §1). Tests that are not about the
* gardener answer it with the first look, so they reach the garden as a returning player does.
*/
export async function pastGardener(page: Page): Promise<void> {
const question = page.getByRole('heading', { level: 2, name: en.gardener.question });
const garden = page.getByRole('button', { name: en.rose.care });
await expect(question.or(garden)).toBeVisible({ timeout: 20_000 });
if (await question.isVisible()) await page.getByRole('button', { name: en.gardener.done }).click();
await expect(garden).toBeVisible();
}
/** Opens the ring of care, as Enter on her (or a tap) does (planet-garden.md G7). */
export async function openRing(page: Page): Promise<void> {
const ring = page.getByRole('group', { name: en.scene.ring });
if (!(await ring.isVisible())) await page.getByRole('button', { name: en.rose.care }).press('Enter');
await expect(ring).toBeVisible();
}