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: Implement polling-based login for CI environments

LearningCircuitd186fce2e672
diff --git a/tests/ui_tests/auth_helper.js b/tests/ui_tests/auth_helper.js
index 4d9c1e9188..027d61ba33 100644
--- a/tests/ui_tests/auth_helper.js
+++ b/tests/ui_tests/auth_helper.js
@@ -158,23 +158,58 @@ class AuthHelper {
});
try {
- // Use the same pattern as main branch - Promise.all for atomic operation
- // In CI, use domcontentloaded for faster response since networkidle2 can timeout
- const waitUntil = process.env.CI ? 'domcontentloaded' : 'networkidle2';
- console.log(` Using waitUntil: ${waitUntil} (CI mode: ${!!process.env.CI})`);
-
- await Promise.all([
- this.page.waitForNavigation({
- waitUntil: waitUntil,
- timeout: 90000 // Increased from 60s for CI
- }),
- this.page.click('button[type="submit"]')
- ]);
- console.log(' Navigation completed');
-
- // In CI, give the page a moment to stabilize after navigation
+ // In CI, try a different approach - click and wait for URL change
if (process.env.CI) {
- await new Promise(resolve => setTimeout(resolve, 1000));
+ console.log(' Using CI-specific login approach (wait for redirect)');
+
+ // Click the submit button
+ await this.page.click('button[type="submit"]');
+
+ // Wait for either navigation or timeout
+ let redirected = false;
+ for (let i = 0; i < 30; i++) {
+ await new Promise(resolve => setTimeout(resolve, 1000));
+ const currentUrl = this.page.url();
+ console.log(` Checking URL (${i+1}/30): ${currentUrl}`);
+
+ if (!currentUrl.includes('/auth/login')) {
+ console.log(' ✅ Redirected away from login page');
+ redirected = true;
+ break;
+ }
+
+ // Check if there's an error message on the page
+ const errorElement = await this.page.$('.alert-danger, .error-message');
+ if (errorElement) {
+ const errorText = await this.page.evaluate(el => el.textContent, errorElement);
+ throw new Error(`Login failed with error: ${errorText.trim()}`);
+ }
+ }
+
+ 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: 'domcontentloaded' });
+ } else {
+ throw new Error('Login failed - no redirect and no session cookie');
+ }
+ }
+
+ console.log(' Navigation completed');
+ } else {
+ // Original logic for non-CI
+ await Promise.all([
+ this.page.waitForNavigation({
+ waitUntil: 'networkidle2',
+ timeout: 90000
+ }),
+ this.page.click('button[type="submit"]')
+ ]);
+ console.log(' Navigation completed');
}
} catch (navError) {
console.log(` Navigation error: ${navError.message}`);