Search Functionality (search-functionality)
Summary
Discovers the search box, runs test queries, and validates results with heuristics (Playwright).
Classification
- Category:
ECOMMERCE - Plugin id:
search-functionality - Version:
2.0.0 - Target types:
WEBSHOP - Weight class:
MEDIUM - Risk level: not set on plugin object
- Browser required: Yes (Playwright)
- Tier / group: Tier 3 — E-commerce / flows (Playwright)
Schedule
- scheduleHints:
{ defaultInterval: '0 */6 * * *', priority: 3 } - Prerequisites: None declared on this plugin.
Configurable inputs
Public keys are derived from inputSchema: z.object({ ... }) (underscore-prefixed keys are runtime-only and omitted here).
| Field | Notes |
|---|---|
searchQuery |
Zod field in inputSchema — see source for defaults, min/max, and .describe(). |
searchSelector |
Zod field in inputSchema — see source for defaults, min/max, and .describe(). |
resultsSelector |
Zod field in inputSchema — see source for defaults, min/max, and .describe(). |
timeout |
Zod field in inputSchema — see source for defaults, min/max, and .describe(). |
waitForResults |
Zod field in inputSchema — see source for defaults, min/max, and .describe(). |
Runtime / injected config
- None documented beyond standard worker context (
target,config,logger,reportProgress). Underscore-prefixed keys are internal.
Checks that produce findings
These checks run inside this plugin during a single test run. They are not separate tests in the database — each becomes a Finding linked to the Run for search-functionality.
| Check | Typical severity | Why |
|---|---|---|
| Search input not found (DOM finder + search toggle attempt) | WARNING | Site search drives product discovery — a missing box blocks catalog navigation on webshops. |
| Search returned no visible results (after trying multiple queries) | WARNING | Empty results for common terms (sko, jacket, test, etc.) suggest broken index or AJAX search. |
Search does not update URL (no search/sok/q= in URL after query) |
INFO | Non-shareable AJAX-only results hurt SEO landing pages and support deep-linking. |
Search input missing ARIA role (role="search" / searchbox) |
INFO | Assistive tech users may not discover the search landmark. |
Search input missing accessible label (label or aria-label) |
WARNING | Unlabeled search fields fail WCAG and screen reader usability. |
| Empty search causes error page (body contains error/feil/404) | WARNING | Empty queries should show validation or neutral results, not error pages. |
JavaScript errors during search (pageerror) |
WARNING | JS failures often break live search widgets and autocomplete. |
How each check works
- Find input — Loads homepage (
domcontentloaded, default 30s). UsessearchSelectoroverride or adaptivefindSearchInput; tries search toggle buttons (aria-label search/søk,.search-toggle, etc.) if hidden. - Query loop — Default queries: 2 Norwegian (
sko,jakke), 1 English (shoes), 1 generic (test) unlesssearchQueryset. Fills input, presses Enter, waits 1.5s, detects results viaresultsSelectoror common containers (.search-results,.product-grid, Algolia.ais-Hits, etc.) withwaitForResultstimeout (default 5000ms). - URL and accessibility checks — After successful search, flags non-updating URLs. Evaluates label/role on discovered selector.
- Empty search — Reloads homepage, submits blank query, waits 2s, scans first 1000 chars of body for error keywords.
- Score and status — Step pass rate × 100.
warningif any WARNING; no CRITICAL findings.
Caveats and concerns
- Fashion-biased default queries — Norwegian/English apparel terms may not match B2B/industrial catalogs; set
searchQueryin test config. - Algolia/InstantSearch — Results may render after timeout; increase
waitForResultsfor slow indexes. - Hidden search UI — Toggle click only tries a short list of selectors; custom themes may still fail discovery.
- URL check is INFO — Many valid SPAs never update URL; not a functional failure.
- WEBSHOP-only scheduling — Often triggered by adaptive orchestrator when deep crawl finds search inputs.
Source
packages/test-plugins/src/plugins/search-functionality.ts