[app] Rose: Wire identity and the care log into the garden; e2e and offline tend the rose

This commit is contained in:
2026-11-02 00:20:59 +01:00
parent 6a3ca84aaa
commit 21f4496910
6 changed files with 138 additions and 8 deletions
+41 -1
View File
@@ -7,7 +7,7 @@ import { nextInvitation } from '@rosea/engine';
import { searchTowns } from '@rosea/content/places';
import { readFileSync } from 'node:fs';
import { BASE, startStaticServer, type StaticServer } from './static-server.js';
import { storedTown } from './stored.js';
import { storedCare, storedTown } from './stored.js';
let server: StaticServer;
@@ -182,3 +182,43 @@ test.describe('the sunset place, in Prague\'s time zone at noon on 29 March 2026
expect((await new AxeBuilder({ page }).analyze()).violations.map((v) => `${v.id}: ${v.help}`)).toEqual([]);
});
});
// --- The rose (.agents/features/rose.md) -------------------------------------
test.describe('the rose, in Prague at 08:00 on 1 March 2026', () => {
test.use({ timezoneId: 'Europe/Prague', locale: 'en-US' });
const MORNING = Date.parse('2026-03-01T08:00:00+01:00');
/** 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 page.getByRole('button', { name: en.rose.water }).hover();
await page.mouse.down();
await page.waitForTimeout(ms);
await page.mouse.up();
}
test('a new rose is a bud; holding Water is one day of care; a reload keeps it', async ({ page }) => {
await page.clock.setFixedTime(MORNING);
const { requests } = await open(page);
await expect(page.getByRole('img', { name: 'The rose, a bud.' })).toBeVisible();
await expect(page.getByText(en.rose.says.dry)).toBeVisible();
await pour(page, 1500);
await expect(page.getByText(en.rose.says.thanks)).toBeVisible();
await page.getByRole('button', { name: en.rose.numbers }).click();
await expect(page.locator('#rose-numbers')).toContainText(`${en.rose.daysOfCare}1`);
await storedCare(page, 1);
await page.reload();
await page.getByRole('button', { name: en.rose.numbers }).click();
await expect(page.locator('#rose-numbers')).toContainText(`${en.rose.daysOfCare}1`);
expect(requests.filter((url) => !url.startsWith(server.origin + '/'))).toEqual([]);
});
test('the rose and her care have no accessibility violations', async ({ page }) => {
await page.clock.setFixedTime(MORNING);
await open(page);
await page.getByRole('button', { name: en.rose.numbers }).click();
await expect(page.locator('#rose-numbers')).toBeVisible();
expect((await new AxeBuilder({ page }).analyze()).violations.map((v) => `${v.id}: ${v.help}`)).toEqual([]);
});
});