Skip to main content

Testing

The console has no domain model, database or message broker, so its test pyramid is short: fast unit and component tests under Vitest, two Playwright smoke scripts run by hand against a dev server, and static gates (oxlint, tsc, the agent-guide and repo lints) in CI. There are no integration, contract, BDD or mutation suites in this repo.

LayerToolingHow to runRuns in CI?
Unit + componentVitest 5, jsdom, Testing Library, mswmake test / npm testyes (test)
Type checktsc -b --noEmitmake typecheck / npm run typecheckyes (typecheck)
Lintoxlint (.oxlintrc.json)make lint / npm run lintyes (lint)
Production buildtsc -b && vite buildmake build / npm run buildyes (build)
Route smokePlaywright (scripts/verify-all-routes.cjs)npm run verify:routesadvisory (verify-routes.yml: weekly, dispatch, PRs touching routing; not a required check)
Dashboard degradationPlaywright (scripts/verify-dashboards.cjs)npm run verify:dashboardsno
Agent-guide / repo config lintsPython stdlib (scripts/harness/)make guide-lint, make harness-test, python3 scripts/harness/repo_lint.pyyes (guide-lint)
Docs siteDocusaurusnpm ci, npm run typecheck, npm run build in docs/yes (docs)

make check runs lint typecheck test build in that order; make check-all is the same; make check-fast is lint typecheck (the agent Stop hook's quick gate).

All the npm scripts need @warehouse/ui-kit checked out and built at ../warehouse-ui-kit (package.json depends on file:../warehouse-ui-kit), which is also how CI lays out its workspace.

Unit and component tests (Vitest)​

vitest.config.ts merges the app's own vite.config.ts and adds:

  • environment: "jsdom", globals: true, css: false, include: ["src/**/*.test.{ts,tsx}"], setupFiles: ["./src/test/setup.ts"];
  • resolve.dedupe: ["react", "react-dom"], because the ui-kit sibling has its own installed React and its useFetch would otherwise run against a second React instance ("Invalid hook call");
  • an alias mapping every <name>_mfe/App import to src/test/remoteUnavailable.ts, a stub that throws on evaluation. A test that renders App therefore sees every remote fail exactly the way an unreachable remoteEntry.js does, which is what RemoteBoundary must handle.

Mocks​

src/test/mocks/server.ts is one shared msw setupServer() with no default handlers. src/test/setup.ts starts it with onUnhandledRequest: "error", resets handlers and unmounts (cleanup()) after each test, and closes it at the end. A test registers the endpoints it needs with server.use(http.get(...)); a screen that starts calling an unstubbed endpoint fails the test instead of quietly rendering its error state. Build URLs from the same constants the code uses (SERVICE_BASE_URL, BFF_BASE_URL, REPORTS_BASE_URL) — under Vitest they resolve to the developer-port fallbacks, since no config.json is loaded.

What is covered (106 tests in 13 files, all passing on this branch)​

FileTestsWhat it pins
src/runtime-config.test.ts15validateRuntimeConfig accepts http/https origins and rejects non-objects, missing/blank/non-string/relative origins, non-HTTP schemes, paths, credentials and queries; loadRuntimeConfig fetches with no-store, and never publishes a non-2xx or non-JSON response
src/config.test.ts5URL resolution under an apiOrigin, the production "missing origin" error, developer-port fallbacks
src/remotes-manifest.test.tsx39the remotes manifest (29 remotes, unique name/container/path/port/route, capacity vs planning distinct, netfulfil_mfe override), the derived federationRemotes() dev/build entry URLs, REMOTE_COMPONENTS parity, every manifest route rendering the "unavailable" card with its label, and verify:routes covering every REPORT_ROUTES slug plus an unknown slug
scripts/verify-all-routes.test.cjs (node --test)4the verify:routes list covers every manifest remote, the product-master packaging deep link, unique paths, and the 404 checks
src/packaging.test.ts4chart image.repository equals what ci.yml publishes, the Dockerfile's builder-base comment names the FROM node: image it uses, .gitignore lists public/config.json, src/config.ts no longer claims Kong lacks a reports route
src/App.test.tsx22the /capacity/*, /product-master/*, /network-inventory/*, /inbound-receiving/* routes render the "unavailable" card when the remote is down, keep "Contexts" active, and do not capture look-alike prefixes
src/shell/RouterLink.test.tsx5client-side navigation for nav items and launch tiles, the skip link, external URLs left to the browser
src/features/floor/FloorScreen.test.tsx8per-path facts, no-signal vs zero, severity ordering, collapsed evidence, backend-flag alarms, retry, last-good data kept on a failed refresh
src/features/contexts/ContextsScreen.test.tsx4the Capacity Planning, Product Master, Network Inventory and Inbound Receiving tiles
src/features/order-lifecycle/toTimelineSteps.test.ts9unavailable vs pending stages, every task of a type, sealed vs labeled, line collapsing, cancelled orders
src/features/context-reports/ContextReportScreen.test.tsx4loading, populated + freshness badge, whole-request error, freshness-only failure
src/features/context-reports/facilityLayout.config.test.tsx4loading, populated, error, empty table
src/features/context-reports/fulfillmentExecution.config.test.tsx4loading, populated, error, empty table
src/features/context-reports/networkFulfillment.config.test.tsx5calls /reports/acknowledgement + /freshness with a window longer than a day, loading, every acknowledgementRowDTO field rendered, error, empty table

Not covered by unit tests: WmsDashboardScreen, WesDashboardScreen, ReportDashboard, OrderLifecycleScreen (only its mapping function), NotFoundScreen, RemoteBoundary in isolation, and six of the nine context-report configs. The App.test.tsx "remote down" stderr output (Error: remote unavailable (unit test stub) … "React will try to recreate this component tree … RemoteErrorBoundary") is expected noise from the stub, not a failure.

Run one file or watch mode:

npx vitest run src/features/floor/FloorScreen.test.tsx
npm run test:watch

Playwright smoke scripts (manual)​

Both scripts drive headless Chromium against http://localhost:5173, so start npm run dev first (with a public/config.json, see Getting started). Both exit 1 on any collected error.

  • npm run verify:routes visits /, /order-lifecycle, /contexts, /wms-dashboard, /wes-dashboard, the remote routes /order-management, /inventory, /planning, /fulfillment, /workforce, /facility, /process-path, /labor, /network-fulfillment, /capacity, /product-master, /network-inventory, /inbound-receiving, every /reports/<slug> in REPORT_ROUTES (each must show its own report heading), /reports/no-such-context and /no-such-screen (both must show "Page not found"). On each it asserts the expected text, that the nav still renders, and records page errors and failed requests. It then clicks the Contexts nav link and fails on a full document navigation. It needs every listed remote's dev server and the APIs (including each <context>-reports reader) at apiOrigin, unless VERIFY_STUB_API=1: then the browser answers every apiOrigin call with a 503 and no backend (or Kong CORS) is needed; the verify-routes workflow runs it that way against every remote's develop (list from src/remotes-manifest.json). Any route showing the remote error card ("This module is unavailable right now") fails. scripts/verify-all-routes.test.cjs fails when a manifest remote is missing from the list; src/remotes-manifest.test.tsx covers the REPORT_ROUTES slugs.
  • npm run verify:dashboards needs only the shell's dev server: it intercepts **/console/reports/wms* and **/console/reports/wes* and checks three states — all sections available (charts draw real geometry), one section available: false (only that card degrades), and a refused connection (one dashboard-level error). Screenshots go to SHOT_DIR (default /tmp/warehouse-console-dashboards).

CI (.github/workflows/ci.yml)​

Triggers: push and pull request on develop and main. The Node jobs check out this repo and IQVO/warehouse-ui-kit@develop side by side, build the ui-kit, then npm ci here.

JobRunsWhen
lintnpm run lintevery push/PR
guide-lintguide_lint.py, repo_lint.py, test_hook.py, test_repo_lint.pyevery push/PR
testnpm testevery push/PR
typechecknpm run typecheckevery push/PR
buildnpm run buildevery push/PR
docsin docs/: npm ci, npm run typecheck, npm run build (Node 20)every push/PR
trivy-fs-scanTrivy filesystem scan, fails on fixable CRITICAL/HIGHevery push/PR
helm-lintct lint --charts charts/warehouse-consolePRs into main only
trivy-scanbuilds the image (not pushed), SARIF upload, fails on fixable CRITICAL/HIGHPRs into main only
docker-publishbuilds, pushes, cosign-signs and SBOM-attests ghcr.io/iqvo/warehouse-consolepush to main only
releasetags the image and git with the next vX.Y.Z, packages and pushes the Helm chart to oci://ghcr.io/iqvo, creates the GitHub releasepush to main only, after docker-publish

So on a PR into develop, helm-lint, trivy-scan, docker-publish and release show as skipped by design.

Other workflows: codeql.yml (push/PR on main and develop), scorecard.yml (push to develop and a schedule), docs.yml (builds the site on every pull request touching docs/** or the workflow, build only; on push to main touching docs/** it also uploads the Pages artifact and deploys; the PR build runs in its own docs-pr-<ref> concurrency group, never the pages one, under the check name docs-site-build), and ai-review.yml (PRs into develop touching internal/domain/**, internal/application/**, apis/** or charts/**; only charts/ exists in this repo, and it is a no-op without the ANTHROPIC_API_KEY secret).

Agent harness (scripts/harness/)​

ScriptPurpose
guide_lint.pychecks .claude/skills/*/SKILL.md frontmatter, .claude/rules paths:, that backticked paths, make targets and ADR numbers cited by CLAUDE.md / .claude/** exist, and the always-loaded context budget
repo_lint.pyconfiguration sensors R1–R7: workflow paths and needs:, Dependabot directories (no npm entry for the file:../warehouse-ui-kit tree), stale owners, template placeholders, Dependabot coverage, workflow script paths
hook.py / test_hook.pythe runtime-agnostic agent pre/post/stop hook and its unit tests
test_repo_lint.pyunit tests for repo_lint.py
fleet_drift.pyfails when .claude/rules/fleet/*.md differ from the canonical copy in IQVO/warehouse-docs (not wired into ci.yml)
red_issue.pyturns a failing scheduled sensor into an issue (not wired into ci.yml)

When you move or rename a docs page, grep .claude/ for its path first: guide-lint fails the PR if a guide still cites the old path.