[ui] TwoTabs: The rose and the garden read again when another tab wrote, keeping their own

This commit is contained in:
2026-11-07 15:06:44 +01:00
parent 102ac44675
commit b67fa3603d
7 changed files with 185 additions and 9 deletions
+39
View File
@@ -241,6 +241,45 @@ test.describe('the rose, in Prague at 08:00 on 1 March 2026', () => {
});
});
// --- Two tabs, one garden (.agents/features/two-tabs.md) ----------------------
test.describe('two tabs of the garden, 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');
test('care given in one tab is seen in the other without a reload, so she is not watered twice', async ({ page, context }) => {
const other = await context.newPage();
for (const p of [page, other]) {
await p.clock.setFixedTime(MORNING);
await open(p);
await expect(p.getByText(en.rose.says.dry)).toBeVisible();
}
await page.getByRole('button', { name: en.rose.water }).hover();
await page.mouse.down();
await page.waitForTimeout(1500);
await page.mouse.up();
await expect(page.getByText(en.rose.says.thanks)).toBeVisible();
await storedCare(page, 1);
// The other tab, untouched and not reloaded, knows she was watered.
await expect(other.getByText(en.rose.says.thanks)).toBeVisible({ timeout: 3_000 });
await other.getByRole('button', { name: en.rose.numbers }).click();
await expect(other.locator('#rose-numbers')).toContainText(`${en.rose.daysOfCare}1`);
});
test('a town chosen in one tab is the town in the other', async ({ page, context }) => {
const other = await context.newPage();
for (const p of [page, other]) {
await p.clock.setFixedTime(MORNING);
await open(p);
await expect(p.getByRole('heading', { level: 2, name: en.sunset.question })).toBeVisible();
}
await page.getByRole('searchbox', { name: en.sunset.searchLabel }).fill('brno');
await page.getByRole('button', { name: /^Brno/ }).first().click();
await storedTown(page, 'Brno');
await expect(other.locator('.sun p').first()).toHaveText(/in Brno\.$/, { timeout: 3_000 });
});
});
// --- Keeping her (.agents/features/keep-her-safe.md) --------------------------
test.describe('keep her safe, in Prague at 08:00 on 1 March 2026', () => {
test.use({ timezoneId: 'Europe/Prague', locale: 'en-US' });