[app] PlanetGarden: e2e passes the gardener question, opens the ring, and pours by tilting the can
This commit is contained in:
@@ -0,0 +1,21 @@
|
||||
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();
|
||||
}
|
||||
Reference in New Issue
Block a user