~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(ui-tests): point collection + mobile tests at the real flow (#4127)
LearningCircuiteee4164c6f97
diff --git a/tests/ui_tests/test_crud_operations_ci.js b/tests/ui_tests/test_crud_operations_ci.jsindex 34e4215938..130fb50245 100644--- a/tests/ui_tests/test_crud_operations_ci.js+++ b/tests/ui_tests/test_crud_operations_ci.js@@ -14,73 +14,97 @@ const { setupTest, teardownTest, TestResults, log, delay, navigateTo, withTimeou// ============================================================================const CollectionCrudTests = {async createCollectionFormOpens(page, baseUrl) {- await navigateTo(page, `${baseUrl}/collections`);-- const { found } = await findActionButton(page, { click: true });- if (!found) {- return { passed: null, skipped: true, message: 'No create collection button found' };+ // Collection creation is a page-navigation flow, not a modal: the+ // "Create Collection" button on /library/collections is an anchor+ // to /library/collections/create. Earlier versions of this test+ // looked for a modal at the (404) /collections route and silently+ // skipped forever. We verify both halves of the real flow:+ // 1. The list page advertises a link to the create page.+ // 2. The create page renders a form with a required name input.++ await navigateTo(page, `${baseUrl}/library/collections`);+ const listInfo = await page.evaluate(() => {+ const link = document.getElementById('create-collection-btn');+ return {+ hasButton: !!link,+ href: link?.getAttribute('href'),+ };+ });+ if (!listInfo.hasButton) {+ return { passed: false, message: 'create-collection-btn missing on /library/collections' };+ }+ if (!listInfo.href || !listInfo.href.includes('/library/collections/create')) {+ return { passed: false, message: `create-collection-btn href is "${listInfo.href}", expected /library/collections/create` };}- await delay(500);-- const result = await page.evaluate(() => {- const modal = document.querySelector('.modal, .dialog, [role="dialog"], .form-modal');- const form = document.querySelector('form.collection-form, form[action*="collection"], .create-form');-+ await navigateTo(page, `${baseUrl}/library/collections/create`);+ const formInfo = await page.evaluate(() => {+ // Two forms exist on every page: the create form and the global+ // logout form. Pick the create form by id (or by excluding logout).+ const createForm = document.querySelector('form:not(#logout-form)');+ const nameInput = document.querySelector('#collection-name, input[name="name"]');+ const submit = createForm?.querySelector('button[type="submit"], input[type="submit"]');return {- hasModal: !!modal && (modal.style.display !== 'none'),- hasForm: !!form,- hasNameInput: !!document.querySelector('input[name*="name"], input[placeholder*="name"], #collection-name'),- hasSubmitBtn: !!document.querySelector('button[type="submit"], .btn-primary, .save-btn')+ hasForm: !!createForm,+ hasNameInput: !!nameInput,+ nameInputRequired: !!nameInput?.required,+ hasSubmit: !!submit,+ submitText: submit?.textContent?.trim() || submit?.value,};});- const passed = result.hasModal || result.hasForm;+ const passed = formInfo.hasForm && formInfo.hasNameInput && formInfo.hasSubmit;return {passed,message: passed- ? `Create collection form opens (modal=${result.hasModal}, nameInput=${result.hasNameInput})`- : 'Create collection form did not open'+ ? `Create page form ok (nameRequired=${formInfo.nameInputRequired}, submit="${formInfo.submitText}")`+ : `Create page missing parts (form=${formInfo.hasForm}, name=${formInfo.hasNameInput}, submit=${formInfo.hasSubmit})`};},async createCollectionFormValidation(page, baseUrl) {- await navigateTo(page, `${baseUrl}/collections`);+ // The create form uses HTML5 `required` on the name input. An empty+ // submit should leave the input in :invalid state and keep us on+ // /library/collections/create (no POST). We do not look for app-level+ // error elements — the contract here is the browser's own validation.- await findActionButton(page, { click: true });- await delay(500);+ await navigateTo(page, `${baseUrl}/library/collections/create`);- // Try to submit empty formconst result = await page.evaluate(() => {- const submitBtn = document.querySelector('button[type="submit"], .btn-primary, .save-btn');- if (submitBtn) submitBtn.click();-- // Check for validation errors- return new Promise(resolve => {- setTimeout(() => {- const hasValidationError = !!document.querySelector(- '.error, .invalid-feedback, .form-error, [class*="error"], .validation-message'- );- const hasRequiredIndicator = !!document.querySelector(- 'input:invalid, .required, [required]'- );- resolve({ hasValidationError, hasRequiredIndicator });- }, 300);- });+ const form = document.querySelector('form:not(#logout-form)');+ const submit = form?.querySelector('button[type="submit"], input[type="submit"]');+ if (!form || !submit) return { hasForm: false };++ // Make sure name is empty, then try to submit.+ const name = document.querySelector('#collection-name, input[name="name"]');+ if (name) name.value = '';+ submit.click();++ return new Promise(resolve => setTimeout(() => {+ const nameEl = document.querySelector('#collection-name, input[name="name"]');+ resolve({+ hasForm: true,+ requiredInvalid: nameEl ? !nameEl.checkValidity() : null,+ stayedOnPage: location.pathname.endsWith('/library/collections/create'),+ });+ }, 300));});- if (!result.hasValidationError && !result.hasRequiredIndicator) {- return { passed: null, skipped: true, message: 'No form validation detected (may submit empty)' };+ if (!result.hasForm) {+ return { passed: false, message: 'Create form not found on /library/collections/create' };}+ const passed = result.requiredInvalid === true && result.stayedOnPage;return {- passed: true,- message: `Form validation works (error=${result.hasValidationError}, required=${result.hasRequiredIndicator})`+ passed,+ message: passed+ ? 'Empty submit blocked by HTML5 :invalid on required name input'+ : `Validation contract failed (requiredInvalid=${result.requiredInvalid}, stayedOnPage=${result.stayedOnPage})`};},async collectionEditButton(page, baseUrl) {- await navigateTo(page, `${baseUrl}/collections`);+ await navigateTo(page, `${baseUrl}/library/collections`);const result = await page.evaluate(() => {const cards = document.querySelectorAll('.collection-card, .collection-item, [data-collection-id]');@@ -118,7 +142,7 @@ const CollectionCrudTests = {},async collectionDeleteConfirmation(page, baseUrl) {- await navigateTo(page, `${baseUrl}/collections`);+ await navigateTo(page, `${baseUrl}/library/collections`);const result = await page.evaluate(() => {const cards = document.querySelectorAll('.collection-card, .collection-item, [data-collection-id]');@@ -180,67 +204,82 @@ const CollectionCrudTests = {// ============================================================================const SubscriptionCrudTests = {async createSubscriptionFormOpens(page, baseUrl) {- await navigateTo(page, `${baseUrl}/news/subscriptions`);+ // Subscription creation is a page-navigation flow, not a modal.+ // #create-subscription-btn on /news/subscriptions is a plain <button>+ // whose JS handler runs `window.location.href = '/news/subscriptions/new'`+ // (see static/js/pages/subscriptions.js). The previous version of this+ // test relied on findActionButton's click landing on a page with+ // some form and accidentally passed via the navigation, not via an+ // assertion of the real contract.- const { found } = await findActionButton(page, { click: true });- if (!found) {- return { passed: null, skipped: true, message: 'No create subscription button found' };+ await navigateTo(page, `${baseUrl}/news/subscriptions`);+ const hasListButton = await page.evaluate(() => !!document.getElementById('create-subscription-btn'));+ if (!hasListButton) {+ return { passed: false, message: 'create-subscription-btn missing on /news/subscriptions' };}- await delay(500);-- const result = await page.evaluate(() => {- const modal = document.querySelector('.modal, .dialog, [role="dialog"], .form-modal');- const form = document.querySelector('form.subscription-form, form[action*="subscription"], .create-form');-+ await navigateTo(page, `${baseUrl}/news/subscriptions/new`);+ const formInfo = await page.evaluate(() => {+ const form = document.querySelector('form:not(#logout-form)');+ const query = document.querySelector('#subscription-query');+ const submit = form?.querySelector('button[type="submit"], input[type="submit"]');return {- hasModal: !!modal && (modal.style.display !== 'none'),hasForm: !!form,- hasQueryInput: !!document.querySelector('input[name*="query"], textarea[name*="query"], #subscription-query'),- hasSubmitBtn: !!document.querySelector('button[type="submit"], .btn-primary, .save-btn')+ hasQueryField: !!query,+ queryRequired: !!query?.required,+ queryTag: query?.tagName,+ hasSubmit: !!submit,+ submitText: submit?.textContent?.trim() || submit?.value,};});- const passed = result.hasModal || result.hasForm || result.hasQueryInput;+ const passed = formInfo.hasForm && formInfo.hasQueryField && formInfo.hasSubmit;return {passed,message: passed- ? `Create subscription form opens (modal=${result.hasModal}, queryInput=${result.hasQueryInput})`- : 'Create subscription form did not open'+ ? `Create page form ok (${formInfo.queryTag} #subscription-query required=${formInfo.queryRequired}, submit="${formInfo.submitText}")`+ : `Create page missing parts (form=${formInfo.hasForm}, query=${formInfo.hasQueryField}, submit=${formInfo.hasSubmit})`};},async subscriptionFormValidation(page, baseUrl) {- await navigateTo(page, `${baseUrl}/news/subscriptions`);+ // The create form uses HTML5 `required` on the query textarea.+ // Empty submit should leave the textarea :invalid and keep us on+ // /news/subscriptions/new (no POST). We assert the browser-level+ // contract rather than scraping app-error selectors.- await findActionButton(page, { click: true });- await delay(500);+ await navigateTo(page, `${baseUrl}/news/subscriptions/new`);- // Try to submit empty formconst result = await page.evaluate(() => {- const submitBtn = document.querySelector('button[type="submit"], .btn-primary, .save-btn');- if (submitBtn) submitBtn.click();-- return new Promise(resolve => {- setTimeout(() => {- const hasValidationError = !!document.querySelector(- '.error, .invalid-feedback, .form-error, [class*="error"]'- );- const hasRequiredIndicator = !!document.querySelector(- 'input:invalid, .required, [required]'- );- resolve({ hasValidationError, hasRequiredIndicator });- }, 300);- });+ const form = document.querySelector('form:not(#logout-form)');+ const submit = form?.querySelector('button[type="submit"], input[type="submit"]');+ if (!form || !submit) return { hasForm: false };++ // Make sure query is empty, then submit.+ const query = document.querySelector('#subscription-query');+ if (query) query.value = '';+ submit.click();++ return new Promise(resolve => setTimeout(() => {+ const queryEl = document.querySelector('#subscription-query');+ resolve({+ hasForm: true,+ requiredInvalid: queryEl ? !queryEl.checkValidity() : null,+ stayedOnPage: location.pathname.endsWith('/news/subscriptions/new'),+ });+ }, 300));});- if (!result.hasValidationError && !result.hasRequiredIndicator) {- return { passed: null, skipped: true, message: 'No form validation detected' };+ if (!result.hasForm) {+ return { passed: false, message: 'Subscription form not found on /news/subscriptions/new' };}+ const passed = result.requiredInvalid === true && result.stayedOnPage;return {- passed: true,- message: `Subscription form validation works`+ passed,+ message: passed+ ? 'Empty submit blocked by HTML5 :invalid on required query textarea'+ : `Validation contract failed (requiredInvalid=${result.requiredInvalid}, stayedOnPage=${result.stayedOnPage})`};},diff --git a/tests/ui_tests/test_library_collections_ci.js b/tests/ui_tests/test_library_collections_ci.jsindex b8735591e5..db0264abd2 100644--- a/tests/ui_tests/test_library_collections_ci.js+++ b/tests/ui_tests/test_library_collections_ci.js@@ -6,7 +6,7 @@** Run: node test_library_collections_ci.js*/-const { setupTest, teardownTest, TestResults, log, delay, navigateTo, withTimeout, findActionButton } = require('./test_lib');+const { setupTest, teardownTest, TestResults, log, delay, navigateTo, withTimeout } = require('./test_lib');// ============================================================================// Library Page Tests@@ -183,13 +183,16 @@ const CollectionsPageTests = {async createCollectionButton(page, baseUrl) {await navigateTo(page, `${baseUrl}/library/collections`);- const { found, text } = await findActionButton(page);+ const { found, href } = await page.evaluate(() => {+ const a = document.querySelector('a#create-collection-btn[href*="/library/collections/create"]');+ return { found: !!a, href: a?.getAttribute('href') };+ });return {passed: found,message: found- ? `Create collection button found ("${text}")`- : 'No create collection button found'+ ? `Create collection anchor found (href: "${href}")`+ : 'No create collection anchor found'};},diff --git a/tests/ui_tests/test_mobile_interactions_ci.js b/tests/ui_tests/test_mobile_interactions_ci.jsindex c2dae4635d..bcdf7747c5 100644--- a/tests/ui_tests/test_mobile_interactions_ci.js+++ b/tests/ui_tests/test_mobile_interactions_ci.js@@ -6,100 +6,52 @@** Run: node test_mobile_interactions_ci.js*/-const { setupTest, teardownTest, TestResults, log, delay, viewports, navigateTo, withTimeout, findActionButton } = require('./test_lib');+const { setupTest, teardownTest, TestResults, log, delay, viewports, navigateTo, withTimeout } = require('./test_lib');// ============================================================================// Mobile Modal Tests// ============================================================================const MobileModalTests = {- async modalOpensOnMobile(page, baseUrl) {- // Set mobile viewport- await page.setViewport({ width: 375, height: 667, isMobile: true, hasTouch: true });- await navigateTo(page, `${baseUrl}/collections`);-- const { found } = await findActionButton(page, { click: true });- if (!found) {- return { passed: null, skipped: true, message: 'No modal trigger button found' };- }+ async createFormFitsMobile(page, baseUrl) {+ // The original test (modalOpensOnMobile) navigated to a 404+ // /collections route expecting a modal-opens-on-click flow. The real+ // app does page navigation for the create flow, so we test the+ // mobile-friendliness of /library/collections/create directly:+ // the form must fit the 375px viewport and the required name input+ // must be a touch-sized hit target (>=44px tall is the Apple HIG+ // minimum; >=30px keeps us tolerant of theme variations).- await delay(500);-- const modalResult = await page.evaluate(() => {- const modal = document.querySelector('.modal, .dialog, [role="dialog"], .sheet');- if (!modal) return { hasModal: false };+ await page.setViewport({ width: 375, height: 667, isMobile: true, hasTouch: true });+ await navigateTo(page, `${baseUrl}/library/collections/create`);- const rect = modal.getBoundingClientRect();- const isVisible = rect.width > 0 && rect.height > 0;- const fitsScreen = rect.width <= window.innerWidth && rect.height <= window.innerHeight;+ const result = await page.evaluate(() => {+ const form = document.querySelector('form:not(#logout-form)');+ const name = document.querySelector('#collection-name, input[name="name"]');+ if (!form || !name) return { hasForm: false };+ const formRect = form.getBoundingClientRect();+ const nameRect = name.getBoundingClientRect();return {- hasModal: true,- isVisible,- fitsScreen,- width: rect.width,- height: rect.height,- screenWidth: window.innerWidth+ hasForm: true,+ formWidth: formRect.width,+ screenWidth: window.innerWidth,+ formFitsScreen: formRect.width <= window.innerWidth,+ nameVisible: nameRect.width > 0 && nameRect.height > 0,+ nameHeight: nameRect.height,+ nameTouchSized: nameRect.height >= 30,};});- if (!modalResult.hasModal) {- return { passed: null, skipped: true, message: 'No modal appeared after clicking trigger' };- }-- return {- passed: modalResult.isVisible && modalResult.fitsScreen,- message: modalResult.fitsScreen- ? `Modal opens on mobile (${modalResult.width}x${modalResult.height})`- : `Modal exceeds screen (${modalResult.width}px > ${modalResult.screenWidth}px)`- };- },-- async modalClosesOnBackdropTap(page, baseUrl) {- await page.setViewport({ width: 375, height: 667, isMobile: true, hasTouch: true });- await navigateTo(page, `${baseUrl}/collections`);-- // Open modal first- await findActionButton(page, { keywords: ['create'], click: true });- await delay(500);-- // Check if modal is open- const modalOpen = await page.evaluate(() => {- return !!document.querySelector('.modal.show, .modal[style*="display: block"], [role="dialog"]');- });-- if (!modalOpen) {- return { passed: null, skipped: true, message: 'Could not open modal for backdrop test' };+ if (!result.hasForm) {+ return { passed: false, message: 'Create form not found on /library/collections/create' };}- // Tap on backdrop- await page.evaluate(() => {- const backdrop = document.querySelector('.modal-backdrop, .overlay, .dialog-backdrop');- if (backdrop) {- backdrop.click();- } else {- // Click outside the modal content- const modal = document.querySelector('.modal, [role="dialog"]');- if (modal) {- const event = new MouseEvent('click', { bubbles: true });- modal.dispatchEvent(event);- }- }- });-- await delay(300);-- const result = await page.evaluate(() => {- const modal = document.querySelector('.modal.show, .modal[style*="display: block"], [role="dialog"]');- return {- modalClosed: !modal || modal.style.display === 'none' || !modal.classList.contains('show')- };- });-+ const passed = result.formFitsScreen && result.nameVisible && result.nameTouchSized;return {- passed: result.modalClosed,- message: result.modalClosed- ? 'Modal closes on backdrop tap'- : 'Modal did not close on backdrop tap'+ passed,+ message: passed+ ? `Create form mobile-fit (${result.formWidth}px form, ${result.nameHeight}px name input)`+ : `Mobile fit failed (formWidth=${result.formWidth}, screen=${result.screenWidth}, nameHeight=${result.nameHeight})`};},@@ -133,48 +85,6 @@ const MobileModalTests = {passed: result.isScrollable || result.overflowY === 'auto',message: `Modal content scrollable: overflow=${result.overflowY}`};- },-- async modalCloseButtonAccessible(page, baseUrl) {- await page.setViewport({ width: 375, height: 667, isMobile: true, hasTouch: true });- await navigateTo(page, `${baseUrl}/collections`);-- // Open modal- await findActionButton(page, { keywords: ['create'], click: true });- await delay(500);-- const result = await page.evaluate(() => {- const closeBtn = document.querySelector(- '.modal .close, ' +- '.modal .btn-close, ' +- '.modal button[aria-label*="close"], ' +- '[role="dialog"] button.close, ' +- '.dialog-close'- );-- if (!closeBtn) return { hasCloseBtn: false };-- const rect = closeBtn.getBoundingClientRect();- // Minimum touch target should be 44x44px for accessibility- const isTappable = rect.width >= 30 && rect.height >= 30;- const isVisible = rect.width > 0 && rect.height > 0;-- return {- hasCloseBtn: true,- isTappable,- isVisible,- size: `${rect.width}x${rect.height}`- };- });-- if (!result.hasCloseBtn) {- return { passed: null, skipped: true, message: 'No close button found in modal' };- }-- return {- passed: result.isTappable && result.isVisible,- message: `Close button accessible (size: ${result.size}, tappable: ${result.isTappable})`- };}};@@ -476,10 +386,8 @@ async function main() {try {// Mobile Modal Testslog.section('Mobile Modals');- await run('Modals', 'Modal Opens On Mobile', (p, u) => MobileModalTests.modalOpensOnMobile(p, u));- await run('Modals', 'Modal Closes On Backdrop Tap', (p, u) => MobileModalTests.modalClosesOnBackdropTap(p, u));+ await run('Modals', 'Create Form Fits Mobile', (p, u) => MobileModalTests.createFormFitsMobile(p, u));await run('Modals', 'Modal Scrollable Content', (p, u) => MobileModalTests.modalScrollableContent(p, u));- await run('Modals', 'Modal Close Button Accessible', (p, u) => MobileModalTests.modalCloseButtonAccessible(p, u));// Mobile Navigation Testslog.section('Mobile Navigation');diff --git a/tests/ui_tests/test_news_subscriptions_ci.js b/tests/ui_tests/test_news_subscriptions_ci.jsindex 27060b76dc..f08afdc79e 100644--- a/tests/ui_tests/test_news_subscriptions_ci.js+++ b/tests/ui_tests/test_news_subscriptions_ci.js@@ -7,7 +7,7 @@* Run: node test_news_subscriptions_ci.js*/-const { setupTest, teardownTest, TestResults, log, delay, navigateTo, withTimeout, findActionButton } = require('./test_lib');+const { setupTest, teardownTest, TestResults, log, navigateTo, withTimeout, findActionButton } = require('./test_lib');// ============================================================================// News Feed Page Tests@@ -288,82 +288,79 @@ const SubscriptionsPageTests = {};},- async subscriptionFormModal(page, baseUrl) {- await navigateTo(page, `${baseUrl}/news/subscriptions`);-- // findActionButton uses word-boundary matching, replacing a brittle- // CSS+XPath fallback that used substring `contains("new")`.- const { found } = await findActionButton(page, { click: true });- if (!found) {- // Check if form is inline instead of modal- const inlineForm = await page.$('form.subscription-form, #subscription-form');- if (inlineForm) {- return { passed: true, message: 'Subscription form is inline (not modal)' };- }- return { passed: null, skipped: true, message: 'No create button to open subscription form' };- }+ async subscriptionFormPage(page, baseUrl) {+ // The Create Subscription flow is page-navigation, not a modal:+ // #create-subscription-btn on /news/subscriptions has a JS handler+ // that runs `window.location.href = '/news/subscriptions/new'`.+ // Earlier this method ("subscriptionFormModal") asserted a modal+ // and accidentally passed when the navigation landed on the new+ // page (which happens to contain a form). Rename + rewrite to+ // test the real flow: navigate directly to /new and assert the+ // create form is present and reachable.- await delay(500);+ await navigateTo(page, `${baseUrl}/news/subscriptions/new`);const result = await page.evaluate(() => {- const modal = document.querySelector('.modal.show, .modal[style*="display: block"], [role="dialog"], .subscription-modal');- const form = document.querySelector('form.subscription-form, #subscription-form, .modal form');-+ const form = document.querySelector('form:not(#logout-form)');+ const query = document.querySelector('#subscription-query');return {- hasModal: !!modal,hasForm: !!form,- hasQueryInput: !!document.querySelector('input[name*="query"], textarea[name*="query"]'),- hasFrequencyInput: !!document.querySelector('input[name*="frequency"], select[name*="frequency"], input[name*="interval"]')+ hasQueryField: !!query,+ queryRequired: !!query?.required,};});- // Close modal if opened- const closeBtn = await page.$('.modal .btn-close, .modal .close, [data-bs-dismiss="modal"]');- if (closeBtn) await closeBtn.click();-- const passed = result.hasModal || result.hasForm;+ const passed = result.hasForm && result.hasQueryField;return {passed,message: passed- ? `Subscription form modal opens (form=${result.hasForm}, query=${result.hasQueryInput}, frequency=${result.hasFrequencyInput})`- : 'Subscription form modal did not open'+ ? `Subscription create form reachable (queryRequired=${result.queryRequired})`+ : `Subscription create form missing (form=${result.hasForm}, query=${result.hasQueryField})`};},async subscriptionFormFields(page, baseUrl) {- await navigateTo(page, `${baseUrl}/news/subscriptions`);+ // The form lives at /news/subscriptions/new and uses+ // `subscription-*` ids (#subscription-query, #subscription-model,+ // #subscription-search-engine, ...). The previous version+ // looked for `name*="query"` / `#query` / etc., which match+ // nothing on the actual page, so this test always reported a+ // misleading SKIP ("Could not find subscription form fields").- // findActionButton uses word-boundary matching so "Back to News Feed" no- // longer triggers on `new`. Replaces the prior CSS+XPath fallback.- const { found } = await findActionButton(page, { click: true });- if (found) {- await delay(500);- }+ await navigateTo(page, `${baseUrl}/news/subscriptions/new`);const result = await page.evaluate(() => {+ const form = document.querySelector('form:not(#logout-form)');+ if (!form) return { hasForm: false };return {- hasQueryField: !!document.querySelector('input[name*="query"], textarea[name*="query"], #query'),- hasTypeField: !!document.querySelector('select[name*="type"], input[name*="type"], #subscription-type'),- hasFrequencyField: !!document.querySelector('input[name*="frequency"], select[name*="frequency"], #frequency'),- hasProviderField: !!document.querySelector('select[name*="provider"], #llm-provider'),- hasModelField: !!document.querySelector('select[name*="model"], #model'),- hasSearchEngineField: !!document.querySelector('select[name*="search"], #search-engine'),- hasActiveToggle: !!document.querySelector('input[type="checkbox"][name*="active"], .toggle-active')+ hasForm: true,+ hasQueryField: !!form.querySelector('#subscription-query'),+ hasModelField: !!form.querySelector('#subscription-model'),+ hasSearchEngineField: !!form.querySelector('#subscription-search-engine'),+ hasStrategyField: !!form.querySelector('#subscription-strategy'),+ hasActiveToggle: !!form.querySelector('#subscription-active'),};});- // Close modal- const closeBtn = await page.$('.modal .btn-close, .modal .close, [data-bs-dismiss="modal"]');- if (closeBtn) await closeBtn.click();-- const hasBasicFields = result.hasQueryField;- if (!hasBasicFields) {- return { passed: null, skipped: true, message: 'Could not find subscription form fields' };+ if (!result.hasForm) {+ return { passed: false, message: 'Subscription form not present at /news/subscriptions/new' };}+ // The query textarea is the core required field. Other fields+ // (model, search engine, strategy, active toggle) round out the+ // expected schema; we treat all four as required signals so the+ // test fails loudly if the form skeleton ever drops a section.+ const passed = result.hasQueryField &&+ result.hasModelField &&+ result.hasSearchEngineField &&+ result.hasStrategyField &&+ result.hasActiveToggle;+return {- passed: true,- message: `Subscription form fields: query=${result.hasQueryField}, type=${result.hasTypeField}, frequency=${result.hasFrequencyField}, provider=${result.hasProviderField}`+ passed,+ message: passed+ ? 'Subscription form has query, model, search-engine, strategy, active toggle'+ : `Subscription form missing fields: query=${result.hasQueryField}, model=${result.hasModelField}, search=${result.hasSearchEngineField}, strategy=${result.hasStrategyField}, active=${result.hasActiveToggle}`};}};@@ -479,7 +476,7 @@ async function main() {await run('Subscriptions', 'Subscription Stats Display', (p, u) => SubscriptionsPageTests.subscriptionStatsDisplay(p, u));await run('Subscriptions', 'Create Subscription Button', (p, u) => SubscriptionsPageTests.createSubscriptionButton(p, u));await run('Subscriptions', 'Subscription Card Structure', (p, u) => SubscriptionsPageTests.subscriptionCardStructure(p, u));- await run('Subscriptions', 'Subscription Form Modal', (p, u) => SubscriptionsPageTests.subscriptionFormModal(p, u));+ await run('Subscriptions', 'Subscription Form Page', (p, u) => SubscriptionsPageTests.subscriptionFormPage(p, u));await run('Subscriptions', 'Subscription Form Fields', (p, u) => SubscriptionsPageTests.subscriptionFormFields(p, u));// API Tests