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: use CI-specific polling approach for registration in auth_helper.js

LearningCircuit0378b5bd04cf
diff --git a/tests/ui_tests/auth_helper.js b/tests/ui_tests/auth_helper.js
index 7ccc33a7e6..557c4f2d65 100644
--- a/tests/ui_tests/auth_helper.js
+++ b/tests/ui_tests/auth_helper.js
@@ -463,7 +463,98 @@ class AuthHelper {
timer.lap('checkbox clicked');
}
- // Submit form
+ // Submit form - use CI-specific polling approach to avoid timeout issues
+ if (this.isCI) {
+ console.log(' Using CI-specific registration approach (polling for redirect)');
+
+ // Click the submit button
+ await this.page.click('button[type="submit"]');
+
+ // Wait for either navigation or timeout - polling approach is more reliable
+ // than waitForNavigation which can hang on slow CI runners
+ let redirected = false;
+ let currentUrl = '';
+
+ // Poll for up to 4 minutes (registration can take 2+ minutes in CI)
+ const maxPolls = 120; // 120 * 2s = 4 minutes
+ for (let i = 0; i < maxPolls; i++) {
+ await this._delay(2000); // Check every 2 seconds
+
+ // Try to get URL with a timeout
+ 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))
+ ]);
+
+ // Log progress every 10 seconds
+ if (i % 5 === 0) {
+ console.log(` Checking URL (${i+1}/${maxPolls}): ${currentUrl}`);
+ }
+ } catch (urlError) {
+ console.log(` Warning: Could not get URL (${i+1}/${maxPolls}): ${urlError.message}`);
+ continue; // Skip this check and try again
+ }
+
+ // Check if we've been redirected away from registration page
+ if (currentUrl && !currentUrl.includes(AUTH_CONFIG.paths.register)) {
+ console.log(' ✅ Redirected away from registration page');
+ redirected = true;
+ break;
+ }
+
+ // Check for error messages on the page (with timeout protection)
+ try {
+ const errorElement = await Promise.race([
+ this.page.$('.alert-danger:not(.alert-warning), .error-message'),
+ new Promise(resolve => setTimeout(() => resolve(null), AUTH_CONFIG.timeouts.errorCheck))
+ ]);
+ if (errorElement) {
+ const errorText = await this.page.evaluate(el => el.textContent, errorElement);
+ if (errorText.includes('already exists')) {
+ console.log('⚠️ User already exists, attempting login instead');
+ return await this.login(username, password);
+ }
+ throw new Error(`Registration failed with error: ${errorText.trim()}`);
+ }
+ } catch (errorCheckError) {
+ if (errorCheckError.message && errorCheckError.message.includes('Registration failed')) {
+ throw errorCheckError;
+ }
+ // Otherwise ignore the error check failure
+ }
+ }
+
+ if (!redirected) {
+ // Last resort: check if we can access the home page (session may be valid)
+ console.log(' Polling timed out, checking session validity...');
+ try {
+ await this.page.goto(this.baseUrl, {
+ waitUntil: AUTH_CONFIG.ci.waitUntil,
+ timeout: AUTH_CONFIG.timeouts.formSelector
+ });
+
+ const homeUrl = this.page.url();
+ if (!homeUrl.includes('/auth/login') && !homeUrl.includes('/auth/register')) {
+ // Check for logout button as proof of login
+ const logoutBtn = await this.page.$('#logout-form, a[href*="logout"], .logout');
+ if (logoutBtn) {
+ console.log(' ✅ Registration succeeded (verified via session)');
+ return true;
+ }
+ }
+ } catch (sessionError) {
+ console.log(` Session check failed: ${sessionError.message}`);
+ }
+
+ throw new Error('Registration timed out - no redirect detected after 4 minutes');
+ }
+
+ console.log('✅ Registration successful');
+ return true;
+ }
+
+ // Non-CI logic - use waitForNavigation
console.log(' Submitting registration form...');
console.log(' ⚠️ This may take 1-3 minutes in CI (database creation + settings import)');
try {
@@ -488,9 +579,9 @@ class AuthHelper {
} catch (navError) {
timer.lap(`submit error: ${navError.message.substring(0, 50)}`);
- // In CI, navigation errors are expected due to frame detachment
- if (this.isCI && navError.message.includes('detached')) {
- console.log(' CI: Navigation error (expected):', navError.message);
+ // Handle frame detachment errors
+ if (navError.message.includes('detached')) {
+ console.log(' Navigation error (frame detached):', navError.message);
// Wait for registration to complete server-side
await this._delay(AUTH_CONFIG.delays.afterRegistration);
timer.lap('post-registration delay complete');
@@ -498,16 +589,16 @@ class AuthHelper {
// Navigate back to home page after registration
try {
await this.page.goto(this.baseUrl, {
- waitUntil: AUTH_CONFIG.ci.waitUntil,
+ waitUntil: 'domcontentloaded',
timeout: AUTH_CONFIG.timeouts.formSelector
});
timer.lap('navigated to home');
} catch (gotoError) {
- console.log(' CI: Could not navigate after registration:', gotoError.message);
+ console.log(' Could not navigate after registration:', gotoError.message);
}
timer.summary();
- console.log('✅ Registration completed (CI mode)');
+ console.log('✅ Registration completed');
return true;
}
timer.summary();