fix: use auto-retrying assertion for bool parameter verification (#23315)

## 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>
This commit is contained in:
Jeremy Ruppel
2026-03-20 15:21:26 -04:00
committed by GitHub
parent a6ba61e607
commit 13703fb5aa
+16 -2
View File
@@ -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":