~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
test(ui-tests): real assertions for news feed (dead-field audit) (#4672)
LearningCircuitef1eaeb6757a
diff --git a/tests/ui_tests/test_news_feed_ci.js b/tests/ui_tests/test_news_feed_ci.jsindex b35dde14b7..2ac37a8ff1 100644--- a/tests/ui_tests/test_news_feed_ci.js+++ b/tests/ui_tests/test_news_feed_ci.js@@ -8,7 +8,7 @@* Run: node test_news_feed_ci.js*/-const { setupTest, teardownTest, TestResults, log, delay, navigateTo, withTimeout } = require('./test_lib');+const { setupTest, teardownTest, TestResults, log, delay, navigateTo, withTimeout, clickAndWaitForNavigation } = require('./test_lib');// ============================================================================// News Feed Page Tests@@ -363,43 +363,54 @@ const NewsTemplatesTests = {async templateClickable(page, baseUrl) {await navigateTo(page, `${baseUrl}/news`);- const result = await page.evaluate(() => {- const template = document.querySelector(- '.template, ' +- '.template-btn, ' +- '[class*="template-item"], ' +- '.query-template'- );-- if (!template) return { hasTemplate: false };-- const searchInput = document.querySelector(- 'input[type="search"], ' +- 'input[placeholder*="search"], ' +- '#news-search'- );-- const beforeValue = searchInput?.value || '';-- // Click template- template.click();-- const afterValue = searchInput?.value || '';-+ // The news-templates sidebar renders <button class="ldr-template-btn"+ // onclick="useNewsTemplate('<id>')">. Clicking a prompt-free template+ // (e.g. 'breaking-news') redirects to /news/subscriptions/new with the+ // query pre-filled — no LLM involved, so this is CI-safe.+ const wiring = await page.evaluate(() => {+ const btns = Array.from(document.querySelectorAll('.ldr-template-btn'));+ const breaking = btns.find(b =>+ (b.getAttribute('onclick') || '').includes("'breaking-news'"));return {- hasTemplate: true,- searchChanged: beforeValue !== afterValue,- afterValue: afterValue.substring(0, 50)+ templateCount: btns.length,+ hasUseNewsTemplate: typeof window.useNewsTemplate === 'function',+ hasBreakingNews: !!breaking,};});- if (!result.hasTemplate) {- return { passed: null, skipped: true, message: 'No template to click' };+ if (wiring.templateCount === 0) {+ // A real failure, not a skip: the templates sidebar is part of the+ // server-rendered news page and must always be present.+ return {+ passed: false,+ message: 'No .ldr-template-btn rendered on the news page'+ };}+ // Click the breaking-news template and require navigation to the+ // create-subscription page, whose page-specific container proves the+ // correct page loaded (not login/error).+ await Promise.all([+ page.waitForNavigation({ waitUntil: 'domcontentloaded', timeout: 15000 }),+ page.evaluate(() => {+ const btns = Array.from(document.querySelectorAll('.ldr-template-btn'));+ const breaking = btns.find(b =>+ (b.getAttribute('onclick') || '').includes("'breaking-news'"));+ (breaking || btns[0]).click();+ }),+ ]);++ const dest = await page.evaluate(() => ({+ path: window.location.pathname,+ hasForm: !!document.querySelector('.ldr-subscription-form-container #subscription-form'),+ query: document.querySelector('#subscription-query')?.value || ''+ }));++ const onSubForm = dest.path.startsWith('/news/subscriptions/new') && dest.hasForm;+return {- passed: result.searchChanged || result.afterValue.length > 0,- message: `Template click: search=${result.searchChanged ? 'changed' : 'unchanged'}, value="${result.afterValue}"`+ passed: onSubForm && wiring.hasBreakingNews && wiring.hasUseNewsTemplate,+ message: `Template click: ${wiring.templateCount} templates -> navigated to "${dest.path}" (form=${dest.hasForm}, query="${dest.query.substring(0, 40)}")`};},@@ -497,58 +508,45 @@ const SubscriptionTests = {};},- async subscriptionsModalOpens(page, baseUrl) {+ async manageSubscriptionsNavigates(page, baseUrl) {await navigateTo(page, `${baseUrl}/news`);- // Click manage subscriptions (only <button> elements, not <a> links that navigate away)- const clicked = await page.evaluate(() => {- const buttons = Array.from(document.querySelectorAll('button'));- const manageBtn = buttons.find(btn => {- const text = btn.textContent?.toLowerCase() || '';- return text.includes('manage') || text.includes('subscriptions');- });-- if (manageBtn) {- manageBtn.click();- return true;- }- return false;+ // On the news page "Manage Subscriptions" is an <a href="/news/subscriptions">+ // link (not a modal trigger). The real, CI-safe behaviour is that it+ // navigates to the standalone subscriptions page. Assert that rather than+ // the old loose "any element whose class contains 'subscription'" check,+ // which matched static page chrome inside dead modal markup.+ const link = await page.evaluate(() => {+ const a = document.querySelector('a[href="/news/subscriptions"]');+ return {+ hasLink: !!a,+ text: a?.textContent?.trim()?.replace(/\s+/g, ' ') || ''+ };});- if (!clicked) {- return { passed: null, skipped: true, message: 'No manage subscriptions button found (only navigation link exists)' };+ if (!link.hasLink) {+ return {+ passed: false,+ message: 'No Manage Subscriptions link (a[href="/news/subscriptions"]) on the news page'+ };}- await delay(500);-- const result = await page.evaluate(() => {- const modal = document.querySelector(- '.modal, ' +- '.subscriptions-modal, ' +- '[role="dialog"], ' +- '.dialog'- );-- const subscriptionsList = document.querySelector(- '.subscriptions-list, ' +- '.subscription-items, ' +- '[class*="subscription"]'- );+ await clickAndWaitForNavigation(page, 'a[href="/news/subscriptions"]', { timeout: 15000 });- return {- hasModal: !!modal && window.getComputedStyle(modal).display !== 'none',- hasList: !!subscriptionsList,- modalVisible: modal ? window.getComputedStyle(modal).display !== 'none' : false- };- });+ const dest = await page.evaluate(() => ({+ path: window.location.pathname,+ // .ldr-subscriptions-page is the page-specific wrapper rendered by+ // pages/subscriptions.html — proves the subscriptions page loaded,+ // not login/error.+ hasPage: !!document.querySelector('.ldr-subscriptions-page'),+ hasGrid: !!document.querySelector('#subscriptions-grid')+ }));- const opened = result.hasModal || result.hasList;+ const ok = dest.path === '/news/subscriptions' && dest.hasPage;return {- passed: opened,- message: opened- ? `Subscriptions modal: modal=${result.hasModal}, list=${result.hasList}`- : 'Subscriptions modal did not open'+ passed: ok,+ message: `Manage Subscriptions "${link.text}" -> "${dest.path}" (page=${dest.hasPage}, grid=${dest.hasGrid})`};},@@ -748,7 +746,7 @@ async function main() {log.section('Subscriptions');await run('Subs', 'Create Button', (p, u) => SubscriptionTests.createSubscriptionButton(p, u));await run('Subs', 'Manage Button', (p, u) => SubscriptionTests.manageSubscriptionsButton(p, u));- await run('Subs', 'Modal Opens', (p, u) => SubscriptionTests.subscriptionsModalOpens(p, u));+ await run('Subs', 'Manage Navigates', (p, u) => SubscriptionTests.manageSubscriptionsNavigates(p, u));await run('Subs', 'Form Fields', (p, u) => SubscriptionTests.subscriptionFormFields(p, u));// Recent Searches