From 926b7e2a5e89a281e53824507abc2f4b519ee4d0 Mon Sep 17 00:00:00 2001 From: Thomas Camlong Date: Fri, 7 Aug 2026 15:49:21 +0200 Subject: [PATCH] test(e2e): wait for login form hydration before filling The customJsx E2E test occasionally failed at login with the form showing 'This field is required' on the username, because the submit button was clicked while the form was still hydrating (it is disabled until mounted) and the field values were reset by the re-mount. Wait for the submit button to become enabled before filling, and assert the username value stuck before submitting. --- e2e/custom-widgets-custom-jsx.spec.ts | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/e2e/custom-widgets-custom-jsx.spec.ts b/e2e/custom-widgets-custom-jsx.spec.ts index 446b265f1..03fef32ec 100644 --- a/e2e/custom-widgets-custom-jsx.spec.ts +++ b/e2e/custom-widgets-custom-jsx.spec.ts @@ -43,9 +43,14 @@ describe("Custom JSX custom widgets", () => { try { await page.goto(`${baseUrl}/auth/login`); + // The submit button is disabled until the form finishes hydrating, so wait for it + // before filling to avoid a hydration re-mount resetting the field values. + const submitButton = page.locator("css=button[type='submit']"); + await expect(submitButton).toBeEnabled({ timeout: 30_000 }); await page.getByLabel("Username").fill(adminCredentials.username); await page.locator("#password").fill(adminCredentials.password); - await page.locator("css=button[type='submit']").click(); + await expect(page.getByLabel("Username")).toHaveValue(adminCredentials.username); + await submitButton.click(); await expect(page).not.toHaveURL(/\/auth\/login/, { timeout: 30_000 }); await page.goto(`${baseUrl}/manage/custom-widgets/new`);