From 13703fb5aa3d523e2b4764c2f4869359dfee708e Mon Sep 17 00:00:00 2001 From: Jeremy Ruppel Date: Fri, 20 Mar 2026 15:21:26 -0400 Subject: [PATCH] fix: use auto-retrying assertion for bool parameter verification (#23315) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit ## Problem Flaky e2e test `create workspace and overwrite default parameters` — the boolean parameter verification reads `"true"` when it should be `"false"`. `verifyParameters` in `site/e2e/helpers.ts` used a one-shot `isChecked()` for boolean parameters (line 214), while the `string`/`number` path used Playwright's auto-retrying `toHaveValue()` with a 15-second timeout. When the settings/parameters page hydrates with React Query data, the Switch can briefly render the default value (`true`) before settling on the override (`false`). The one-shot check captures the stale state. ## Fix Replace the one-shot `isChecked()` + `expect().toEqual()` with Playwright's auto-retrying `toBeChecked()` / `not.toBeChecked()` assertions using a 15-second timeout, matching the pattern already used for string/number parameters. Fixes coder/internal#1414 Authored by coder agent 🤖 --------- Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com> --- site/e2e/helpers.ts | 18 ++++++++++++++++-- 1 file changed, 16 insertions(+), 2 deletions(-) diff --git a/site/e2e/helpers.ts b/site/e2e/helpers.ts index db0896743a..06b55a5c92 100644 --- a/site/e2e/helpers.ts +++ b/site/e2e/helpers.ts @@ -210,9 +210,23 @@ export const verifyParameters = async ( switch (richParameter.type) { case "bool": { + // Use auto-retrying assertions to avoid capturing + // a stale default value before data hydration + // completes. const parameterField = parameterLabel.locator("input"); - const value = await parameterField.isChecked(); - expect(value.toString()).toEqual(buildParameter.value); + if (buildParameter.value === "true") { + await expect(parameterField).toBeChecked({ + timeout: 15_000, + }); + } else if (buildParameter.value === "false") { + await expect(parameterField).not.toBeChecked({ + timeout: 15_000, + }); + } else { + throw new Error( + `Invalid boolean build parameter value: ${buildParameter.value}`, + ); + } } break; case "string":