Wait for the toggle PUT to land before reloading in the feature e2e test
Some checks failed
CI / build-and-push (push) Successful in 44s
CI / deploy-qa (push) Successful in 11s
CI / smoke-qa (push) Failing after 23s

The click fires an async toggle-state update; reloading immediately after
raced it and read back the pre-toggle value, flaking the persistence check.
This commit is contained in:
2026-07-04 18:42:10 -07:00
parent 37e00bf756
commit cfb6c5bde3

View File

@@ -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 toggle.click({ force: true });
await expect(toggle).toBeChecked({ checked: !wasChecked }); 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. // Reload to confirm the toggle was persisted to the real API/DB, not just local state.
await page.reload(); await page.reload();
const reloadedRow = page.getByRole('row', { name: new RegExp(featureName) }); const reloadedRow = page.getByRole('row', { name: new RegExp(featureName) });