Wait for the token editor to take focus before typing a child formula in the calculator e2e test

Adding a child calculation swaps the expression input for the token editor, which takes focus on the next frame.
On a slow CI runner the formula could be typed before that swap and get lost, leaving no result ("-" instead of 60).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
Shinuwa 2026-11-18 19:49:50 +01:00
parent fc43444995
commit ddd1b271dd

View file

@ -94,7 +94,12 @@ test("current values are subtracted from totals and kept during recalculation",
await expect(tool.locator(".calculator-result strong")).toHaveAttribute("aria-label", "8"); await expect(tool.locator(".calculator-result strong")).toHaveAttribute("aria-label", "8");
await tool.getByRole("button", { name: "Enregistrer", exact: true }).click(); await tool.getByRole("button", { name: "Enregistrer", exact: true }).click();
await tool.getByRole("button", { name: "Ajouter un calcul enfant Parent", exact: true }).click(); await tool.getByRole("button", { name: "Ajouter un calcul enfant Parent", exact: true }).click();
// Le calcul enfant remplace le champ par l'éditeur à jetons, qui prend le focus à l'image suivante : sur une machine lente,
// saisir avant ce passage perdait la formule.
await expect(expression).toHaveAttribute("contenteditable", "true");
await expect(expression).toBeFocused();
await expression.fill("base * 10"); await expression.fill("base * 10");
await expect(tool.locator(".calculator-result strong")).toHaveAttribute("aria-label", "80");
await subtractCurrent.click(); await subtractCurrent.click();
await current.fill("20"); await current.fill("20");
await tool.getByLabel("Libellé", { exact: true }).fill("Child"); await tool.getByLabel("Libellé", { exact: true }).fill("Child");