Compare commits

...

1 Commits

Author SHA1 Message Date
Mathias Fredriksson 74b1a34d1f fix(e2e): handle bool parameter hydration race in fillParameters
The bool case in fillParameters blindly toggled the switch with a
single click. If dynamic parameters hydrated after the click and
reset the switch state, the final value was wrong, causing the
'overwrite default parameters' test to flake.

Mirror the retry pattern already used for string/number parameters:
read the current aria-checked state, click only if it differs from
the desired value, then verify and retry up to 3 times.
2026-03-09 20:14:26 +00:00
+24 -1
View File
@@ -1051,8 +1051,31 @@ const fillParameters = async (
switch (richParameter.type) {
case "bool":
{
const wantChecked = buildParameter.value === "true";
const parameterField = parameterLabel.locator("button");
await parameterField.click();
// Dynamic parameters can hydrate after initial render
// and reset the switch state. Check the current value
// and retry the click if needed.
for (let attempt = 0; attempt < 3; attempt++) {
const isChecked =
(await parameterField.getAttribute("aria-checked")) ===
"true";
if (isChecked !== wantChecked) {
await parameterField.click();
}
try {
await expect(parameterField).toHaveAttribute(
"aria-checked",
String(wantChecked),
{ timeout: 1000 },
);
break;
} catch (error) {
if (attempt === 2) {
throw error;
}
}
}
}
break;
case "string":