test(ui): wait for the target node's Reinstall button after the popstate

The "generic deletion blocks targeted install at confirmation" spec
dispatches a popstate to set the target node, then waits for a button
named Reinstall and clicks it. Until React renders the targeted page,
the page still draws the generic Reinstall button. It is enabled and has
the same name, so the wait passed on it, the click started a global
install, and no node install request was sent. The poll on the install
count timed out with the confirm dialog still open.

With the CPU throttled to 8x, the spec failed on 20 of 20 runs, and the
button it clicked had the title "Reinstall". The spec now waits for the
button titled "Reinstall on <node>". With the throttle it passes 30 of
30 runs. 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 07:25:12 +00:00
1 parent 484e25b1f5
commit 9f5c094fa6
1 file changed
+7 -5
@@ -414,11 +414,13 @@ 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())
// The popstate renders the targeted page in a later commit. Until then the
// page still draws the generic Reinstall button, which is enabled and has
// the same name, so the wait must be for the button of the target node. A
// click on the generic one sends no node request.
const onTarget = reinstall(page).and(page.getByTitle(`Reinstall on ${ids[0]}`))
await expect(onTarget).toBeEnabled()
await onTarget.evaluate(el => el.click())
await expect.poll(() => s.installs.length).toBe(1)
if (beforeConfirm) {
await confirm(page).click()