test(ui): wait for the targeted Reinstall button before the install click

The "generic deletion blocks targeted install at confirmation" spec
dispatches a popstate to set the target node, then clicks Reinstall with
a script click. The click can run before the targeted page has rendered
or while the button is still disabled, so no install request is sent and
the poll on the install count times out. It failed 1 run in 10 with two
workers and on every retry in CI.

The spec now waits for the button to be enabled first. The assertions
are unchanged.

Assisted-by: Claude Code:claude-sonnet-5-5 playwright
Signed-off-by: Ettore Di Giacinto <mudler@localai.io>
This commit is contained in:
Ettore Di Giacinto committed 2026-10-21 02:35:04 +00:00
1 parent c24de4fc21
commit 50f0f3de26
1 file changed
+4
@@ -414,6 +414,10 @@ for (const beforeConfirm of [false, true]) test(`generic deletion blocks targete
history.pushState({}, '', url); dispatchEvent(new PopStateEvent('popstate'))
}, ids[0])
}
// The popstate renders the targeted page in a later commit. A click that
// lands before it reaches a button that is missing or still disabled and
// sends nothing.
await expect(reinstall(page)).toBeEnabled()
await reinstall(page).evaluate(el => el.click())
await expect.poll(() => s.installs.length).toBe(1)
if (beforeConfirm) {