X Tutup
Skip to content

fix(e2e): handle bool parameter hydration race in fillParameters#22860

Open
mafredri wants to merge 1 commit intomainfrom
e2e-fix
Open

fix(e2e): handle bool parameter hydration race in fillParameters#22860
mafredri wants to merge 1 commit intomainfrom
e2e-fix

Conversation

@mafredri
Copy link
Member

@mafredri mafredri commented Mar 9, 2026

Problem

The e2e test create workspace and overwrite default parameters was flaking because fillParameters blindly toggled the boolean switch with a single click. If dynamic parameters hydrated after the click and reset the switch state, the final value was wrong -- the verification step would find the checkbox still checked (true) when it expected false.

Root Cause

The bool case in fillParameters (helpers.ts) did:

const parameterField = parameterLabel.locator("button");
await parameterField.click();

This toggle-style interaction is inherently racy: it assumes the switch has already rendered with its default value before the click. Dynamic parameters can hydrate after initial render and overwrite the toggled state, which is exactly the same class of bug that was already fixed for string/number parameters with a retry loop.

Fix

Mirror the retry pattern already used for string/number parameters:

  1. Read the current aria-checked attribute to determine switch state
  2. Only click if the current state differs from the desired value
  3. Verify the state matches after clicking
  4. Retry up to 3 times to handle post-hydration resets

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.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant

X Tutup