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.

fix(tests): disable Chrome leak-detection dialog that ate CDP input after login (#4430) (#4501)

LearningCircuit8b8caee91654
diff --git a/tests/puppeteer/helpers/index.js b/tests/puppeteer/helpers/index.js
index 9d3618647e..843f1ac051 100644
--- a/tests/puppeteer/helpers/index.js
+++ b/tests/puppeteer/helpers/index.js
@@ -10,6 +10,10 @@
const path = require('path');
const fs = require('fs');
+// Shared across both E2E suites — plain relative require works
+// because both suites live in the same repo checkout.
+const { createSeededChromeProfile } = require('../../shared/chrome_profile');
+
// Test configuration
const BASE_URL = process.env.TEST_URL || 'http://localhost:5000';
const HEADLESS = process.env.HEADLESS !== 'false';
@@ -340,6 +344,18 @@ async function ensureLoggedIn(page, username, password) {
return !url.includes('/login');
}
+// Lazy + memoized seeded profile, mirroring BROWSER_CONFIG.userDataDir in
+// tests/ui_tests/browser_config.js: create the throwaway dir once and reuse
+// it for every launch in this process, so re-invoking getLaunchOptions()
+// doesn't strand an extra profile dir until exit.
+let seededProfileDir = null;
+function getSeededProfileDir() {
+ if (!seededProfileDir) {
+ seededProfileDir = createSeededChromeProfile();
+ }
+ return seededProfileDir;
+}
+
/**
* Get Puppeteer launch options
* @returns {object} Launch options for puppeteer.launch()
@@ -349,6 +365,13 @@ function getLaunchOptions() {
headless: HEADLESS,
slowMo: SLOW_MO,
protocolTimeout: 120000,
+ // Seeded profile that disables Chrome's password leak detection.
+ // The CI credentials are in Chrome's breach database, so after a
+ // successful login an invisible tab-modal "data breach" dialog
+ // would otherwise swallow all real CDP keyboard/mouse input for
+ // the rest of the tab's life — see
+ // tests/shared/chrome_profile.js and issue #4430.
+ userDataDir: getSeededProfileDir(),
args: ['--no-sandbox', '--disable-setuid-sandbox', '--window-size=1400,900']
};
}
diff --git a/tests/puppeteer/test_openai_api_key_ui.js b/tests/puppeteer/test_openai_api_key_ui.js
index 965e4c6a93..14821f1e96 100644
--- a/tests/puppeteer/test_openai_api_key_ui.js
+++ b/tests/puppeteer/test_openai_api_key_ui.js
@@ -10,6 +10,7 @@
const puppeteer = require('puppeteer');
const { expect } = require('chai');
+const { getLaunchOptions } = require('./helpers');
// Test configuration
const BASE_URL = process.env.TEST_URL || 'http://localhost:5000';
@@ -24,10 +25,9 @@ describe('OpenAI API Key Configuration UI Test', function() {
let page;
before(async () => {
- browser = await puppeteer.launch({
- headless: process.env.HEADLESS !== 'false',
- args: ['--no-sandbox', '--disable-setuid-sandbox']
- });
+ // Shared options include the seeded profile that disables Chrome's
+ // password leak detection (see helpers/index.js and #4430).
+ browser = await puppeteer.launch(getLaunchOptions());
page = await browser.newPage();
// Set viewport for consistent testing
diff --git a/tests/shared/chrome_profile.js b/tests/shared/chrome_profile.js
new file mode 100644
index 0000000000..2259dad3ae
--- /dev/null
+++ b/tests/shared/chrome_profile.js
@@ -0,0 +1,82 @@
+/**
+ * Seeded Chrome profile for Puppeteer tests.
+ *
+ * Why this exists (#4430)
+ * =======================
+ * The CI test credentials (test_admin / testpass123) appear in Chrome's
+ * breached-credential database. After a SUCCESSFUL login with such a pair,
+ * Chrome's password leak detection opens a tab-modal "password found in a
+ * data breach" dialog. In headless the dialog is invisible, but it still
+ * swallows ALL real (CDP-dispatched) mouse and keyboard input for that tab,
+ * permanently: page.type()/page.click() silently do nothing on every page
+ * visited after login, while page.evaluate(), Input.insertText and JS
+ * .click() keep working. That is exactly the "CDP input not delivered to
+ * /chat/ in headless" failure — /chat/ was a red herring; any tab that
+ * performed the login is affected (failed logins and fresh tabs are not).
+ *
+ * Leak detection has no working command-line switch in current Chrome
+ * (--disable-features=PasswordLeakDetection no longer has any effect), so
+ * the only reliable off-switch is the profile preference
+ * profile.password_manager_leak_detection. This helper creates a throwaway
+ * user-data-dir with that pref (plus credentials_enable_service=false to
+ * also suppress the save-password bubble) for puppeteer.launch().
+ */
+
+const fs = require('fs');
+const os = require('os');
+const path = require('path');
+
+const createdDirs = [];
+
+/**
+ * Create a temporary Chrome user-data-dir whose Default profile disables
+ * password leak detection and the password manager. Each call returns a
+ * fresh directory, so concurrent browser launches never fight over a
+ * profile lock. Directories are best-effort removed on process exit.
+ *
+ * @returns {string} Absolute path to pass as puppeteer's userDataDir.
+ */
+function createSeededChromeProfile() {
+ const dir = fs.mkdtempSync(path.join(os.tmpdir(), 'ldr-chrome-profile-'));
+ fs.mkdirSync(path.join(dir, 'Default'), { recursive: true });
+ fs.writeFileSync(
+ path.join(dir, 'Default', 'Preferences'),
+ JSON.stringify({
+ // Pref names map to JSON paths by their dots, so the two
+ // password-manager prefs land at different depths on purpose:
+ // kCredentialsEnableService is registered as the top-level
+ // "credentials_enable_service", while leak detection is
+ // "profile.password_manager_leak_detection".
+ profile: {
+ password_manager_leak_detection: false,
+ password_manager_enabled: false,
+ },
+ credentials_enable_service: false,
+ })
+ );
+ createdDirs.push(dir);
+ return dir;
+}
+
+function cleanupProfiles() {
+ for (const dir of createdDirs.splice(0)) {
+ try {
+ fs.rmSync(dir, { recursive: true, force: true });
+ } catch (_) {
+ // Best effort — CI containers are ephemeral anyway.
+ }
+ }
+}
+
+process.on('exit', cleanupProfiles);
+// 'exit' does not fire on signals (local Ctrl-C, CI step timeouts).
+// Clean up, then re-raise so the default termination behavior — and any
+// other handlers' exit codes — still apply.
+for (const sig of ['SIGINT', 'SIGTERM']) {
+ process.once(sig, () => {
+ cleanupProfiles();
+ process.kill(process.pid, sig);
+ });
+}
+
+module.exports = { createSeededChromeProfile };
diff --git a/tests/ui_tests/browser_config.js b/tests/ui_tests/browser_config.js
index 19bfafb40b..a51d14c52a 100644
--- a/tests/ui_tests/browser_config.js
+++ b/tests/ui_tests/browser_config.js
@@ -3,8 +3,13 @@
* Prevents bookmark prompts and other UI interruptions
*/
+const { createSeededChromeProfile } = require('../shared/chrome_profile');
+
const BROWSER_CONFIG = {
headless: Boolean(process.env.CI),
+ // userDataDir is defined as a lazy getter below so merely importing
+ // this module (some scripts import both configs) doesn't create an
+ // unused profile directory.
args: [
'--no-sandbox',
'--disable-setuid-sandbox',
@@ -40,6 +45,22 @@ const BROWSER_CONFIG = {
}
};
+// Disables Chrome's password leak detection, whose invisible tab-modal
+// "data breach" dialog otherwise eats all real CDP input after logging
+// in with the CI credentials — see chrome_profile.js and issue #4430.
+// Lazy + memoized: the profile directory is only created when a launch
+// actually reads the option.
+let seededProfileDir = null;
+Object.defineProperty(BROWSER_CONFIG, 'userDataDir', {
+ enumerable: true,
+ get() {
+ if (!seededProfileDir) {
+ seededProfileDir = createSeededChromeProfile();
+ }
+ return seededProfileDir;
+ }
+});
+
/**
* Page initialization options
*/
diff --git a/tests/ui_tests/chat/test_chat_suggestion_chips.js b/tests/ui_tests/chat/test_chat_suggestion_chips.js
index 82ceba0f82..22b9c23b03 100644
--- a/tests/ui_tests/chat/test_chat_suggestion_chips.js
+++ b/tests/ui_tests/chat/test_chat_suggestion_chips.js
@@ -130,14 +130,10 @@ async function run() {
);
if (!firstQuery) throw new Error('First chip missing data-query');
- // evaluate().click() fires the chip's JS handler directly. A
- // real page.click() depends on CDP synthetic-input delivery to
- // the /chat/ renderer, which is unreliable headless (see the
- // tracked "CDP input not delivered to /chat/" issue) — the
- // new-chat test works around the same way.
- await page.evaluate(() =>
- document.querySelector('.ldr-chat-suggestion').click()
- );
+ // Real click for genuine interaction coverage. CDP input used
+ // to be swallowed after login by Chrome's password-leak dialog
+ // (#4430); that is disabled via chrome_profile.js now.
+ await page.click('.ldr-chat-suggestion');
// Welcome screen hides (chat.js inside handleSend)
await page.waitForFunction(
@@ -182,11 +178,8 @@ async function run() {
try {
await gotoChat(page);
- // First click — starts a chat. JS .click() (not page.click) for
- // the same CDP-input-delivery reason as Test 2.
- await page.evaluate(() =>
- document.querySelector('.ldr-chat-suggestion').click()
- );
+ // First click — starts a chat.
+ await page.click('.ldr-chat-suggestion');
// Wait until the first user message is in the DOM
await page.waitForFunction(
() =>
@@ -197,7 +190,10 @@ async function run() {
);
// Click another chip — should be a no-op because isProcessing is
- // true. JS .click() for the same CDP-input-delivery reason.
+ // true. JS .click() here on purpose: the welcome screen (and the
+ // chips) are already hidden at this point, so a real page.click
+ // would fail on a non-visible node; the guard under test is the
+ // handler's isProcessing check, not input delivery.
await page.evaluate(() => {
const chips = document.querySelectorAll('.ldr-chat-suggestion');
if (chips[1]) chips[1].click();
diff --git a/tests/ui_tests/puppeteer_config.js b/tests/ui_tests/puppeteer_config.js
index f0b8ed32bd..53539b9434 100644
--- a/tests/ui_tests/puppeteer_config.js
+++ b/tests/ui_tests/puppeteer_config.js
@@ -2,8 +2,22 @@
* Puppeteer configuration helper for CI/Docker environments
*/
+const { createSeededChromeProfile } = require('../shared/chrome_profile');
+
const isCI = !!process.env.CI;
+// Lazy + memoized seeded profile, mirroring BROWSER_CONFIG.userDataDir in
+// browser_config.js: create the throwaway dir once and reuse it for every
+// launch in this process, so re-invoking getPuppeteerLaunchOptions()
+// doesn't strand an extra profile dir until exit.
+let seededProfileDir = null;
+function getSeededProfileDir() {
+ if (!seededProfileDir) {
+ seededProfileDir = createSeededChromeProfile();
+ }
+ return seededProfileDir;
+}
+
/**
* Take a screenshot only if not in CI mode
* @param {Page} page - Puppeteer page object
@@ -27,6 +41,15 @@ async function takeScreenshot(page, filepath, options = {}) {
function getPuppeteerLaunchOptions(additionalOptions = {}) {
const defaultOptions = {
headless: true,
+ // Seeded profile that disables Chrome's password leak detection.
+ // Without it, logging in with the CI credentials triggers an
+ // invisible tab-modal "data breach" dialog that eats all real
+ // CDP keyboard/mouse input for the rest of the tab's life — see
+ // tests/shared/chrome_profile.js and issue #4430. Only created
+ // when the caller doesn't bring their own profile dir.
+ ...(additionalOptions.userDataDir
+ ? {}
+ : { userDataDir: getSeededProfileDir() }),
// Protocol timeout needs to be long enough for registration flow
// which creates encrypted DB, derives key, creates tables, and imports 500+ settings
// This can take 60+ seconds in CI environments
diff --git a/tests/ui_tests/run_all_tests.js b/tests/ui_tests/run_all_tests.js
index 83d9584ea1..6098e490fd 100644
--- a/tests/ui_tests/run_all_tests.js
+++ b/tests/ui_tests/run_all_tests.js
@@ -416,7 +416,9 @@ const tests = [
file: 'chat/test_chat_keyboard_and_input.js',
shard: 'chat-core',
description: 'Tests Enter-to-send, Shift+Enter newline, textarea state',
- skipCI: true, // CDP synthetic key events aren't delivered to the /chat/ renderer headless — see #4430. Needs real key delivery (Enter/Shift+Enter default actions).
+ // Re-enabled: the "CDP input not delivered" failure (#4430) was
+ // Chrome's password-leak-detection dialog after login, now disabled
+ // via the seeded profile in chrome_profile.js.
},
{
name: 'Chat CSRF Required Test',