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: Simplify CI login approach to avoid URL polling timeouts

LearningCircuitd85028c3a7fe
diff --git a/tests/ui_tests/auth_helper.js b/tests/ui_tests/auth_helper.js
index f35aa2ce6a..0c25ebfd11 100644
--- a/tests/ui_tests/auth_helper.js
+++ b/tests/ui_tests/auth_helper.js
@@ -309,79 +309,57 @@ class AuthHelper {
});
try {
- // In CI, try a different approach - click and wait for URL change
+ // In CI, use a simpler and faster approach
if (this.isCI) {
- console.log(' Using CI-specific login approach (wait for redirect)');
+ console.log(' Using CI-specific login approach');
timer.lap('starting CI login');
- // Click the submit button
- await this.page.click('button[type="submit"]');
- timer.lap('submit clicked');
-
- // Wait for either navigation or timeout
- let redirected = false;
- for (let i = 0; i < 30; i++) {
- await this._delay(AUTH_CONFIG.delays.retryNavigation);
-
- // Try to get URL with a timeout
- let currentUrl;
- try {
- currentUrl = await Promise.race([
- this.page.evaluate(() => window.location.href),
- new Promise((_, reject) => setTimeout(() => reject(new Error('URL check timeout')), AUTH_CONFIG.timeouts.urlCheck))
- ]);
- console.log(` Checking URL (${i+1}/30): ${currentUrl}`);
- } catch (urlError) {
- console.log(` Warning: Could not get URL (${i+1}/30): ${urlError.message}`);
- continue; // Skip this check and try again
- }
-
- if (currentUrl && !currentUrl.includes(AUTH_CONFIG.paths.login)) {
- console.log(' ✅ Redirected away from login page');
- redirected = true;
- break;
- }
-
- // Check if there's an error message on the page (with timeout protection)
- try {
- const errorElement = await Promise.race([
- this.page.$('.alert-danger, .error-message, .flash-message'),
- new Promise(resolve => setTimeout(() => resolve(null), AUTH_CONFIG.timeouts.errorCheck))
- ]);
- if (errorElement) {
- const errorText = await this.page.evaluate(el => el.textContent, errorElement);
- throw new Error(`Login failed with error: ${errorText.trim()}`);
- }
- } catch (errorCheckError) {
- if (errorCheckError.message && errorCheckError.message.includes('Login failed')) {
- throw errorCheckError;
- }
- // Otherwise ignore the error check failure
- }
-
- // In CI mode, give up after configured attempts if we're still on login page
- // This likely means the user doesn't exist
- if (i >= AUTH_CONFIG.ci.maxLoginAttempts && currentUrl && currentUrl.includes(AUTH_CONFIG.paths.login)) {
- console.log(` Login not succeeding after ${AUTH_CONFIG.ci.maxLoginAttempts} attempts, user likely does not exist`);
- throw new Error('Login failed - user does not exist');
- }
- }
-
- if (!redirected) {
- // Check cookies to see if we're actually logged in
- const cookies = await this.page.cookies();
- console.log(` Still on login page. Cookies: ${cookies.length}`);
- const sessionCookie = cookies.find(c => c.name === 'session');
- if (sessionCookie) {
- console.log(' Session cookie exists, manually navigating to home');
- await this.page.goto(this.baseUrl, { waitUntil: AUTH_CONFIG.ci.waitUntil });
+ // Use Promise.all with waitForNavigation - the standard approach
+ // This is more reliable than polling page.evaluate()
+ try {
+ await Promise.all([
+ this.page.waitForNavigation({
+ waitUntil: 'domcontentloaded',
+ timeout: 30000 // 30 seconds should be plenty for login redirect
+ }),
+ this.page.click('button[type="submit"]')
+ ]);
+ timer.lap('navigation complete after submit');
+ console.log(' ✅ Navigation completed');
+ } catch (navError) {
+ timer.lap(`navigation error: ${navError.message.substring(0, 50)}`);
+ console.log(` Navigation error: ${navError.message}`);
+
+ // Check if we actually succeeded despite the error
+ const currentUrl = this.page.url();
+ console.log(` Current URL: ${currentUrl}`);
+
+ if (!currentUrl.includes(AUTH_CONFIG.paths.login)) {
+ console.log(' ✅ Actually redirected successfully');
} else {
- timer.summary();
- throw new Error('Login failed - no redirect and no session cookie');
+ // Check for session cookie - login may have worked
+ const cookies = await this.page.cookies();
+ const sessionCookie = cookies.find(c => c.name === 'session');
+ if (sessionCookie) {
+ console.log(' Session cookie exists, navigating to home');
+ await this.page.goto(this.baseUrl, {
+ waitUntil: 'domcontentloaded',
+ timeout: 15000
+ });
+ timer.lap('navigated to home via cookie');
+ } else {
+ // Check for error message
+ const errorEl = await this.page.$('.alert-danger, .error-message');
+ if (errorEl) {
+ const errorText = await this.page.evaluate(el => el.textContent.trim(), errorEl);
+ throw new Error(`Login failed: ${errorText}`);
+ }
+ throw new Error('Login failed - no redirect, no cookie');
+ }
}
}
- timer.lap('CI login redirect complete');
+ timer.lap('CI login complete');
console.log(' Navigation completed');
} else {
// Non-CI logic - use domcontentloaded instead of networkidle2 to avoid WebSocket/polling timeouts