[app] ChairSunset: e2e watches the in-game sunset; the offline suite watches one with the server gone
This commit is contained in:
+8
-1
@@ -78,7 +78,8 @@ test('the shell opens from the service worker with the server gone', async ({ br
|
||||
// coming back days later with no signal.
|
||||
await page.close();
|
||||
const again = await context.newPage();
|
||||
await again.clock.setFixedTime(Date.parse('2026-03-29T12:00:00+02:00'));
|
||||
// An installed clock, so the in-game sunset's half minute can be run below.
|
||||
await again.clock.install({ time: Date.parse('2026-03-29T12:00:00+02:00') });
|
||||
await again.goto(server.url);
|
||||
await expect(again.getByRole('heading', { level: 1 })).toHaveText(PRODUCT_NAME);
|
||||
await expect(again.locator('.sun p').first()).toHaveText(/in Plzeň\.$/);
|
||||
@@ -86,6 +87,12 @@ test('the shell opens from the service worker with the server gone', async ({ br
|
||||
await again.getByRole('button', { name: en.rose.numbers }).click();
|
||||
await expect(again.locator('#rose-numbers')).toContainText(`${en.rose.daysOfCare}1`);
|
||||
|
||||
// Watching an in-game sunset with no network (CLAUDE.md §3, the offline suite).
|
||||
await again.getByRole('button', { name: en.chair.move }).click();
|
||||
await again.clock.runFor(30_000);
|
||||
await expect(again.getByRole('dialog').getByText(/in Plzeň\.$/)).toBeVisible();
|
||||
await again.keyboard.press('Escape');
|
||||
|
||||
// 3. A deep link inside the scope falls back to the shell, not an error page.
|
||||
await again.goto(`${server.url}somewhere/deeper`);
|
||||
await expect(again.getByRole('heading', { level: 1 })).toHaveText(PRODUCT_NAME);
|
||||
|
||||
@@ -279,3 +279,31 @@ test.describe('keep her safe, in Prague at 08:00 on 1 March 2026', () => {
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
// --- The in-game sunset (.agents/features/chair-sunset.md) ---------------------
|
||||
test.describe('the in-game sunset, in Prague at noon on 29 March 2026', () => {
|
||||
test.use({ timezoneId: 'Europe/Prague', locale: 'en-US' });
|
||||
|
||||
test('move the chair: half a minute with nothing to press, then the real sunset\'s time; again; back', async ({ page }) => {
|
||||
// An installed clock, so the scene's half minute can be run in a moment.
|
||||
await page.clock.install({ time: Date.parse('2026-03-29T12:00:00+02:00') });
|
||||
await open(page);
|
||||
await page.getByRole('button', { name: /^Not now/ }).click();
|
||||
await page.getByRole('button', { name: en.chair.move }).click();
|
||||
|
||||
const scene = page.getByRole('dialog', { name: en.chair.scene });
|
||||
await expect(scene).toBeVisible();
|
||||
await expect(scene.getByRole('button')).toHaveCount(0);
|
||||
expect((await new AxeBuilder({ page }).analyze()).violations.map((v) => `${v.id}: ${v.help}`)).toEqual([]);
|
||||
|
||||
await page.clock.runFor(30_000);
|
||||
await expect(scene.getByText(/^Tonight the sun sets at .* in Prague\.$/)).toBeVisible();
|
||||
expect((await new AxeBuilder({ page }).analyze()).violations.map((v) => `${v.id}: ${v.help}`)).toEqual([]);
|
||||
|
||||
await scene.getByRole('button', { name: en.chair.again }).click();
|
||||
await expect(scene.getByRole('button')).toHaveCount(0);
|
||||
await page.keyboard.press('Escape');
|
||||
await expect(scene).toHaveCount(0);
|
||||
await expect(page.getByRole('button', { name: en.chair.move })).toBeFocused();
|
||||
});
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user