Skip to content

~95% on SimpleQA (e.g. Qwen3.6-27B on a 3090). Supports all local and cloud LLMs (llama.cpp, Ollama, Google, ...). 10+ search engines - arXiv, PubMed, your private documents. Everything Local & Encrypted.

test(ui): fail auth.setup loudly on a non-redirect login response (#4784)

LearningCircuit8edcc6ca24b4
diff --git a/tests/ui_tests/playwright/tests/auth.setup.js b/tests/ui_tests/playwright/tests/auth.setup.js
index b5785853cf..ada9954c62 100644
--- a/tests/ui_tests/playwright/tests/auth.setup.js
+++ b/tests/ui_tests/playwright/tests/auth.setup.js
@@ -30,8 +30,39 @@ setup('authenticate', async ({ page }) => {
await page.fill('input[name="username"]', TEST_USERNAME);
await page.fill('input[name="password"]', TEST_PASSWORD);
- // Submit the form
- await page.click('button[type="submit"]');
+ // Submit the form and capture the server's response to the login POST.
+ // On success the handler returns a 302 redirect to '/'; a login *failure*
+ // re-renders the page with an explicit error status (401 bad credentials /
+ // unregistered user, 429 lockout, 503 DB-init failure). Asserting that
+ // status here makes those login failures fail fast (~1s) with a named
+ // cause instead of the opaque waitForURL('/') timeout below — e.g. the
+ // SQLCipher KDF mismatch fixed in PR #4775 only ever surfaced as a 30s
+ // navigation hang. (A post-302 hang — slow/broken index, missing session —
+ // is still caught by the waitForURL / .ldr-user-info checks, just less
+ // specifically; this assertion only covers the login-response subset.)
+ const [loginResponse] = await Promise.all([
+ page.waitForResponse(
+ (r) =>
+ r.url().includes('/auth/login') && r.request().method() === 'POST',
+ ),
+ page.click('button[type="submit"]'),
+ ]);
+
+ const status = loginResponse.status();
+ if (status >= 400) {
+ // Keep the remediation pointer durable: name the symptom and point at the
+ // workflow's KDF note rather than re-listing env-var names here (those were
+ // already renamed once in #4558 and would rot in two places).
+ throw new Error(
+ `Login failed for "${TEST_USERNAME}": POST /auth/login returned HTTP ${status}. ` +
+ 'A 401 means the credentials were rejected — wrong password, an ' +
+ 'unregistered user (no encrypted DB), or a SQLCipher KDF/cipher ' +
+ 'mismatch between the DB-init step and the server step (see the KDF ' +
+ 'note in .github/workflows/playwright-webkit-tests.yml and PR #4775). ' +
+ 'A 429 means the account is locked; a 503 means the server could not ' +
+ 'initialise the database.',
+ );
+ }
// Wait for navigation to complete (authentication successful)
await page.waitForURL('/', { timeout: 60000 });