~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.
Python academiaanthropicarxivbravedeep-researchencryptionhome-automationhomeserverlocallocal-deep-researchlocal-llmmistralollamaopenaipubmedresearchresearch-toolretrieval-augmented-generationsearxngself-hosted
fix: Fix UI test failures with improved logout handling and error recovery
LearningCircuitcaf60b9d82f7
diff --git a/tests/ui_tests/auth_helper.js b/tests/ui_tests/auth_helper.jsindex b398e87f30..a614ed5f90 100644--- a/tests/ui_tests/auth_helper.js+++ b/tests/ui_tests/auth_helper.js@@ -257,39 +257,75 @@ class AuthHelper {async logout() {console.log('🚪 Logging out...');- // Look for logout link/button- const logoutLink = await this.page.$('a.logout-btn');- if (logoutLink) {- await this.page.click('a.logout-btn');- } else {- // Try to find and submit the logout form- const logoutForm = await this.page.$('#logout-form');- if (logoutForm) {- await this.page.evaluate(() => {- document.getElementById('logout-form').submit();- });+ try {+ // Look for logout link/button+ const logoutLink = await this.page.$('a.logout-btn');+ if (logoutLink) {+ console.log(' Found logout link, clicking...');+ await Promise.all([+ this.page.waitForNavigation({+ waitUntil: 'networkidle2',+ timeout: 10000+ }).catch(err => {+ console.log(' Navigation wait timed out, checking URL...');+ }),+ this.page.click('a.logout-btn')+ ]);} else {- // Fallback: create and submit a logout form- await this.page.evaluate(() => {- const form = document.createElement('form');- form.method = 'POST';- form.action = '/auth/logout';- document.body.appendChild(form);- form.submit();- });+ // Try to find and submit the logout form+ const logoutForm = await this.page.$('#logout-form');+ if (logoutForm) {+ console.log(' Found logout form, submitting...');+ await Promise.all([+ this.page.waitForNavigation({+ waitUntil: 'networkidle2',+ timeout: 10000+ }).catch(err => {+ console.log(' Navigation wait timed out, checking URL...');+ }),+ this.page.evaluate(() => {+ document.getElementById('logout-form').submit();+ })+ ]);+ } else {+ // Fallback: navigate directly to logout URL+ console.log(' No logout button/form found, navigating directly to /auth/logout...');+ await this.page.goto(`${this.page.url().split('/').slice(0, 3).join('/')}/auth/logout`, {+ waitUntil: 'networkidle2',+ timeout: 10000+ });+ }}- }- // Wait for navigation to complete- await this.page.waitForNavigation({ waitUntil: 'networkidle2' });+ // Give it a moment for any redirects+ await this.page.waitForTimeout(1000);- // Ensure we're on the login page- const currentUrl = this.page.url();- if (!currentUrl.includes('/auth/login')) {- console.log(`Warning: After logout, not on login page. Current URL: ${currentUrl}`);- }+ // Ensure we're on the login page or logged out+ const currentUrl = this.page.url();+ console.log(` Current URL after logout: ${currentUrl}`);- console.log('✅ Logged out successfully');+ // Check if we're logged out by looking for login form+ const loginForm = await this.page.$('form[action*="login"], input[name="username"]');+ if (loginForm || currentUrl.includes('/auth/login')) {+ console.log('✅ Logged out successfully');+ } else {+ // Double-check by trying to access a protected page+ await this.page.goto(`${this.page.url().split('/').slice(0, 3).join('/')}/settings/`, {+ waitUntil: 'networkidle2',+ timeout: 5000+ }).catch(() => {});++ const finalUrl = this.page.url();+ if (finalUrl.includes('/auth/login')) {+ console.log('✅ Logged out successfully (verified via protected page)');+ } else {+ console.log(`Warning: May not be fully logged out. Current URL: ${finalUrl}`);+ }+ }+ } catch (error) {+ console.log(`⚠️ Logout error: ${error.message}`);+ // Continue anyway - we'll verify logout status+ }}}diff --git a/tests/ui_tests/test_pages_browser.js b/tests/ui_tests/test_pages_browser.jsindex 1ae387c6fa..d0343271dc 100644--- a/tests/ui_tests/test_pages_browser.js+++ b/tests/ui_tests/test_pages_browser.js@@ -19,7 +19,7 @@ class BrowserTester {async setup() {console.log('🚀 Starting browser test session...');- const browser = await puppeteer.launch(getPuppeteerLaunchOptions());+ this.browser = await puppeteer.launch(getPuppeteerLaunchOptions());this.page = await this.browser.newPage();this.authHelper = new AuthHelper(this.page, this.baseUrl);@@ -236,7 +236,13 @@ const settingsPageTests = async (page) => {// Main test runnerasync function runAllTests() {const tester = new BrowserTester();- await tester.setup();++ try {+ await tester.setup();+ } catch (error) {+ console.error('❌ Failed to setup browser:', error.message);+ process.exit(1);+ }// Ensure screenshots directory existsawait tester.page.evaluate(() => {@@ -295,7 +301,10 @@ async function runAllTests() {// Run tests if this file is executed directlyif (require.main === module) {- runAllTests().catch(console.error);+ runAllTests().catch(error => {+ console.error('💥 Test runner crashed:', error);+ process.exit(1);+ });}module.exports = { BrowserTester, runAllTests };