test(18): make timezone e2e deterministic and align with WR-01 fix

The timezone-verify spec assumed a first-run (unset) starting state, but
e2e global-setup truncated only the list/event tables — never app_config —
so a prior run's saved household_timezone leaked across runs. Clear that key
in global-setup so the spec always starts from isExplicitlySet:false.

Also repurpose the stale "Save disabled when unchanged" assertion: after the
WR-01 fix, first-run Save is correctly ENABLED when the input matches the
displayed default (saving confirms the detected zone). The disabled-when-
unchanged-and-explicit case remains covered by the persist-across-reload test.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This commit is contained in:
Lucas Berger
2026-06-14 23:07:36 -04:00
co-authored by Claude Opus 4.8
parent 79ea94f4b9
commit ddeb87cdba
2 changed files with 17 additions and 2 deletions
+10 -2
View File
@@ -30,11 +30,19 @@ test.describe('Admin Timezone section — 18-04 round-trip', () => {
expect(val.length, 'Input should have a non-empty timezone').toBeGreaterThan(0);
});
test('Save button is disabled when timezone is unchanged', async ({ page }) => {
test('Save is enabled on first run when timezone is not yet explicit (WR-01)', async ({ page }) => {
// On first run the GET returns isExplicitlySet:false with the detected zone
// pre-filled. Saving that value to make the choice explicit is a meaningful
// action, so Save must be ENABLED even though the input matches the displayed
// default. (The disabled-when-unchanged behaviour for an already-explicit
// value is covered by the "Save persists" test below, which re-disables Save
// after a successful save.)
const tzSection = page.getByRole('region', { name: 'Timezone' });
// Confirm we are in the first-run (system-default) state for this assertion.
await expect(tzSection.getByText('Using system default')).toBeVisible();
const saveBtn = tzSection.getByRole('button', { name: /Save|Saving/ });
await expect(saveBtn).toBeVisible();
await expect(saveBtn).toBeDisabled();
await expect(saveBtn).toBeEnabled();
});
test('Changing the input enables Save', async ({ page }) => {