From cfb6c5bde36d7fbb73819e7aee5e11b0edbc0862 Mon Sep 17 00:00:00 2001 From: James Wampler Date: Sat, 4 Jul 2026 18:42:10 -0700 Subject: [PATCH] Wait for the toggle PUT to land before reloading in the feature e2e test The click fires an async toggle-state update; reloading immediately after raced it and read back the pre-toggle value, flaking the persistence check. --- src/admin/e2e/features.e2e.ts | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/admin/e2e/features.e2e.ts b/src/admin/e2e/features.e2e.ts index aa6c4ce..493f738 100644 --- a/src/admin/e2e/features.e2e.ts +++ b/src/admin/e2e/features.e2e.ts @@ -32,6 +32,10 @@ test('creating a feature adds it to the table and its toggle can be flipped', as await toggle.click({ force: true }); await expect(toggle).toBeChecked({ checked: !wasChecked }); + // The click's own toggle-state PUT is async; wait for it to land before reloading, + // otherwise the reload can race it and read back the pre-toggle value. + await page.waitForLoadState('networkidle'); + // Reload to confirm the toggle was persisted to the real API/DB, not just local state. await page.reload(); const reloadedRow = page.getByRole('row', { name: new RegExp(featureName) });