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-tests): convert dead ctrlEnterSubmit orphan into a CI-safe keyboard-submit test (#4652)

LearningCircuit413620299044
diff --git a/tests/ui_tests/test_keyboard_accessibility_ci.js b/tests/ui_tests/test_keyboard_accessibility_ci.js
index 2c6482da47..8074144d19 100644
--- a/tests/ui_tests/test_keyboard_accessibility_ci.js
+++ b/tests/ui_tests/test_keyboard_accessibility_ci.js
@@ -226,32 +226,49 @@ const KeyboardShortcutsTests = {
},
async ctrlEnterSubmit(page, baseUrl) {
+ // The Ctrl/Cmd+Enter "submit from anywhere" shortcut is a document-level
+ // handler (research.js:672 document keydown -> :684-688 submits on
+ // ctrlKey||metaKey + Enter -> handleResearchSubmit -> POST /api/start_research).
+ // The old test asserted the URL changed (navigation), which needs an LLM —
+ // start_research returns 400 "Model is required" in the no-LLM shard, so it
+ // could never pass and was left unregistered. Assert the shortcut fires the
+ // submit POST instead (made regardless of the 400, so deterministic).
+ //
+ // We type the query, then BLUR the textarea before pressing Ctrl+Enter. This
+ // isolates the modifier: the textarea also submits on PLAIN Enter
+ // (research.js:740-742), so pressing Ctrl+Enter while focused there would pass
+ // even if the Ctrl/Cmd-specific paths regressed. From <body>, only the
+ // document-level Ctrl/Cmd+Enter handler can fire the submit. waitForRequest is
+ // armed before the keypress to avoid a race.
await navigateTo(page, `${baseUrl}/`);
- // Focus on textarea
const textarea = await page.$('textarea[name="query"], textarea#query');
if (!textarea) {
- return { passed: null, skipped: true, message: 'No textarea to test Ctrl+Enter' };
+ return { passed: false, message: 'No query textarea found on /' };
}
+ await textarea.type('Test query for keyboard submission');
+ // Move focus off the textarea so plain Enter can't submit — isolates Ctrl+Enter.
+ await page.evaluate(() => document.activeElement && document.activeElement.blur());
+
+ // A submit POST goes to /api/start_research (research mode) or
+ // /api/chat/sessions (chat mode); either proves the shortcut submitted.
+ const submitRequest = page.waitForRequest(
+ (req) => req.method() === 'POST'
+ && (req.url().includes('/api/start_research') || req.url().includes('/api/chat/sessions')),
+ { timeout: 8000 }
+ ).catch(() => null);
- await textarea.type('Test query');
-
- const beforeUrl = page.url();
-
- // Press Ctrl+Enter
await page.keyboard.down('Control');
await page.keyboard.press('Enter');
await page.keyboard.up('Control');
- await delay(1000);
-
- const afterUrl = page.url();
-
+ const req = await submitRequest;
+ const passed = !!req;
return {
- passed: beforeUrl !== afterUrl,
- message: beforeUrl !== afterUrl
- ? 'Ctrl+Enter submits form'
- : 'Ctrl+Enter did not submit form'
+ passed,
+ message: passed
+ ? `Ctrl+Enter (from body) submits the form (POST ${new URL(req.url()).pathname})`
+ : 'Ctrl+Enter did not trigger a submit request'
};
}
};
@@ -599,6 +616,7 @@ async function main() {
log.section('Keyboard Shortcuts');
await run('Shortcuts', 'Documented', (p, u) => KeyboardShortcutsTests.shortcutsDocumented(p, u));
+ await run('Shortcuts', 'Ctrl+Enter Submits', (p, u) => KeyboardShortcutsTests.ctrlEnterSubmit(p, u));
// Focus Management
log.section('Focus Management');