[app] PlanetGarden: e2e passes the gardener question, opens the ring, and pours by tilting the can

This commit is contained in:
2026-11-17 19:15:24 +01:00
parent 5576af4fac
commit 52d8c0bfd1
7 changed files with 137 additions and 12 deletions
+9
View File
@@ -7,6 +7,7 @@ import { nextInvitation, nextSunEvent } from '@rosea/engine';
import { searchTowns } from '@rosea/content/places';
import { readFileSync } from 'node:fs';
import { BASE, startStaticServer, type StaticServer } from './static-server.js';
import { openRing, pastGardener } from './garden.js';
import { storedCare, storedTown } from './stored.js';
let server: StaticServer;
@@ -29,6 +30,7 @@ async function open(page: Page): Promise<{ requests: string[]; cspViolations: st
});
await page.goto(server.url);
await expect(page.getByRole('heading', { level: 1 })).toHaveText(PRODUCT_NAME);
await pastGardener(page);
// Let the worker register and precache, so its requests are counted too.
await page.waitForFunction(() => navigator.serviceWorker.ready.then(() => true), null, { timeout: 20_000 });
return { requests, cspViolations };
@@ -204,6 +206,7 @@ test.describe('the rose, in Prague at 08:00 on 1 March 2026', () => {
/** Holds the Water button with the mouse, as a player holds it with a finger. */
async function pour(page: Page, ms: number): Promise<void> {
await openRing(page);
await page.getByRole('button', { name: en.rose.water }).hover();
await page.mouse.down();
await page.waitForTimeout(ms);
@@ -232,6 +235,7 @@ test.describe('the rose, in Prague at 08:00 on 1 March 2026', () => {
// The clock is driven, not frozen: taps at one frozen instant would be one touch.
await page.clock.install({ time: MORNING });
await open(page);
await openRing(page);
const touch = page.getByRole('button', { name: en.rose.touch.label });
await touch.click();
await expect(page.locator('.bubble')).toHaveText(en.rose.touch.fond[0]!);
@@ -249,6 +253,7 @@ test.describe('the rose, in Prague at 08:00 on 1 March 2026', () => {
test('a touched control shows no browser tap box (seen on a real Android tablet)', async ({ page }) => {
await page.clock.setFixedTime(MORNING);
await open(page);
await openRing(page);
const highlight = await page.getByRole('button', { name: en.rose.water }).evaluate((el) => getComputedStyle(el).getPropertyValue('-webkit-tap-highlight-color'));
expect(highlight.replace(/\s/g, '')).toBe('rgba(0,0,0,0)');
});
@@ -274,6 +279,7 @@ test.describe('two tabs of the garden, in Prague at 08:00 on 1 March 2026', () =
await open(p);
await expect(p.getByText(en.rose.says.dry)).toBeVisible();
}
await openRing(page);
await page.getByRole('button', { name: en.rose.water }).hover();
await page.mouse.down();
await page.waitForTimeout(1500);
@@ -314,8 +320,10 @@ test.describe('keep her safe, in Prague at 08:00 on 1 March 2026', () => {
const page = await first.newPage();
await page.clock.setFixedTime(MORNING);
await page.goto(server.url);
await pastGardener(page);
await page.getByRole('searchbox', { name: en.sunset.searchLabel }).fill('brno');
await page.getByRole('button', { name: /^Brno/ }).first().click();
await openRing(page);
await page.getByRole('button', { name: en.rose.water }).hover();
await page.mouse.down();
await page.waitForTimeout(1500);
@@ -340,6 +348,7 @@ test.describe('keep her safe, in Prague at 08:00 on 1 March 2026', () => {
const page = await second.newPage();
await page.clock.setFixedTime(MORNING + 3_600_000);
await page.goto(server.url);
await pastGardener(page);
await expect(page.getByRole('img', { name: 'The rose, a bud.' })).toBeVisible();
await page.getByRole('button', { name: en.rose.safe.title }).click();
await page.getByLabel(en.rose.safe.bringBack).setInputFiles({ name: 'rose-2026-03-01.json', mimeType: 'application/json', buffer: Buffer.from(saved) });