Skip to main content

Knowledge > Runbooks > Technical Ops > Running Tests

Running Tests

Test suites across all active codebases. Each codebase uses Playwright for E2E and either Vitest or Node's built-in test runner for unit/integration.

All E2E tests run against production URLs by default (or localhost with a dev server). There is no staging environment — see feedback_test_against_production.md.


Quick Reference

SuiteCommandRuntimeWhen to run
Knowledge integritypnpm test in C:\dev\knowledge\~5sBefore every knowledge commit
CWA unit/integrationpnpm test:all in churchwiseai-web/~10sBefore every PR
CWA E2E (fast)pnpm test:e2e in churchwiseai-web/~2minBefore every PR
CWA delivers (lifecycle)npx playwright test e2e/delivers/ in churchwiseai-web/~5minPre-launch, weekly
CWA agent simpnpm test:sim in churchwiseai-web/~10minBefore voice/chatbot changes
PewSearch E2Epnpm test:e2e in pewsearch/web/~2minBefore every PR
ITW E2Epnpm test:e2e in sermon-illustrations/~2minBefore every PR

1. Knowledge Tests (C:\dev\knowledge\)

Runner: Vitest | Count: 99 tests across 10 test files

cd C:\dev\knowledge
pnpm test

Test files

FileWhat it checks
tests/index-completeness.test.tsEvery doc has required frontmatter (title, description, last-verified). Hard-fails on missing description:.
tests/links-integrity.test.tsAll relative markdown links resolve to real files. INDEX.md is generateable.
tests/secret-detection.test.tsNo actual API keys, tokens, or secrets in doc content.
tests/derive-e2e.test.tsDerive pipeline runs without errors for all sources.

2. ChurchWiseAI Web (C:\dev\churchwiseai-web\)

Unit & Integration Tests

Runner: Node built-in test runner (tsx) | Location: src/test/

cd C:\dev\churchwiseai-web
pnpm test:all # all unit + integration tests
pnpm test:chatbot # same (alias)
pnpm test:sermon # sermon generation only
FileWhat it tests
unit/moderation.test.tsContent moderation blocklist patterns
unit/content-moderation.test.tsFull moderation pipeline
unit/faq-matcher.test.tsCanned response semantic matching
unit/denomination-packs.test.tsDenomination-specific response packs
unit/lens-vocabulary.test.tsTheological lens vocabulary filters
unit/tool-config.test.tsChatbot tool access by tier
unit/sermon-generation.test.tsSermonWise AI generation
unit/social-*.test.tsShareWiseAI — auth, crypto, OAuth, platforms, pricing, AI
integration/chatbot-tools.test.tsChatbot tool call integration (hits Supabase)
e2e/multi-turn-chat.test.tsMulti-turn chatbot conversation flow

E2E Tests

Runner: Playwright | Location: e2e/ | Config: playwright.config.ts

cd C:\dev\churchwiseai-web
pnpm test:e2e # all specs, auto-starts dev server on :3002
pnpm test:e2e:ui # Playwright UI mode (visual debugging)
pnpm test:e2e:update-snapshots # Refresh visual snapshots

# Run against production (skip dev server)
BASE_URL=https://churchwiseai.com pnpm test:e2e

Browsers: Desktop Chrome, iPad Mini, iPhone 12 (3 parallel projects)

Root-level specs

SpecWhat it tests
admin.spec.tsAdmin dashboard tabs, RBAC, data display
api.spec.ts + api-new-routes.spec.tsAPI route availability and responses
care.spec.tsCare messaging subscribe/broadcast
crud-admin-*.spec.tsAdmin CRUD: care, settings, training
crud-chatbot.spec.tsChatbot config CRUD
crud-contact.spec.tsContact form submission
crud-social-*.spec.tsShareWiseAI: campaigns, platforms, posts, settings
edge-auth-rbac.spec.tsRole-based access edge cases
edge-chatbot.spec.tsChatbot edge cases
edge-cross-site.spec.tsCross-site script injection, header checks
edge-input-validation.spec.tsForm input validation
edge-rate-limiting.spec.tsRate limit enforcement
env-integration.spec.tsRequired env vars are set
journey-*.spec.tsEnd-to-end user journeys
legal-pages.spec.tsPrivacy policy, terms pages
onboard.spec.tsChurch onboarding flow
p2-security.spec.tsSecurity headers, auth gates
p4-seo-metadata.spec.tsSEO meta tags, structured data
p5-content-accuracy.spec.tsMarketing copy accuracy vs DB
p7-branding.spec.tsBrand consistency
production-smoke-all-sites.spec.tsSmoke test all 4 properties
security.spec.tsSecurity hardening checks

e2e/delivers/ — Product Delivers (Persona-Based)

Philosophy: Test OUTCOMES not STATUS CODES. "Did the pastor find the right plan?" not "Did /pricing return 200?"

# Fast lifecycle (no live API calls) — run every PR
npx playwright test e2e/delivers/ --grep-invert "@live" --project=desktop

# Theological chatbot (weekly / pre-launch — hits real AI APIs)
npx playwright test e2e/delivers/theological/ --grep "@live" --project=desktop

# Known-bug specs only (check which are now fixed)
npx playwright test e2e/delivers/known-bugs/ --project=desktop

# Cross-property (production URLs required)
TEST_PRODUCTION=1 npx playwright test e2e/delivers/cross-property/ --project=desktop
FolderSpecsWhat
delivers/churchwiseai/01–08Full CWA lifecycle: discovery → understanding → signup → onboarding → dashboard → chatbot config → theological setup → upgrade
delivers/personas/9 personasSkeptical/edge-case buyers: Pastor Ezekiel (AI skeptic), Karen (privacy paranoid), Deacon Bob (board evaluation), committee buyer, Mark (mega-church IT), Pastor Maria (Catholic), Pastor Ruth (tiny church), Pastor Steve (burned before), Youth Pastor Jake (mobile)
delivers/theological/7 specsVocabulary safety for Baptist, Catholic, Orthodox, Pentecostal, Reformed; crisis escalation; landing page claims
delivers/cross-property/2 specsPewSearch→CWA upsell, ITW→SermonWise cross-sell
delivers/consistency/4 specsFeature claims accuracy, price matching, product_knowledge alignment, stale copy detection
delivers/known-bugs/6 specsDocumented UX bugs (test.fixme) — become regression guards when fixed

e2e/experience/ and e2e/quality/

  • experience/cta-clarity.spec.ts — CTA button copy and placement
  • experience/error-messages.spec.ts — User-facing error message quality
  • quality/chatbot-denomination-accuracy.spec.ts — Chatbot responses per denomination

Agent Simulation Tests

Runner: Custom tsx runner | Location: tests/agent-sim/

Drives real conversations against the live chatbot or voice agent runtime, records transcripts + tool traces, and asserts against outcomes.

cd C:\dev\churchwiseai-web
pnpm test:sim # all cases (chat + voice)
pnpm test:sim:chat # chat agent only
pnpm test:sim:voice # voice agent only
pnpm test:sim:dry # dry run — parse cases only, no execution

# Single case
npx tsx tests/agent-sim/runner.ts --case chat_prayer_confidential

# By tag
npx tsx tests/agent-sim/runner.ts --tag safety
  • Cases defined in YAML files under tests/agent-sim/cases/
  • Rubrics in tests/agent-sim/rubrics/
  • Results saved to tests/agent-sim/results/
  • Global invariant: admin tokens and service keys must NEVER appear in agent responses

3. PewSearch (C:\dev\pewsearch\web\)

Runner: Playwright | Location: e2e/

cd C:\dev\pewsearch\web
pnpm test:e2e
pnpm test:e2e:ui
pnpm test:e2e:update-snapshots
SpecWhat
admin.spec.tsPewSearch admin dashboard
chatbot.spec.tsChatbot widget on church pages
checkout.spec.tsPremium Page checkout
church-detail.spec.tsChurch listing page
claim.spec.tsChurch claiming flow
crud-*.spec.tsAdmin CRUD: add church, settings, training
demo.spec.tsDemo page
directory.spec.tsSearch, filter, pagination
legal.spec.tsLegal pages
delivers/01–07Full lifecycle: discovery → browse → find listing → claim → premium → admin → upsell

4. IllustrateTheWord (C:\dev\sermon-illustrations\)

Runner: Playwright | Location: e2e/

cd C:\dev\sermon-illustrations
pnpm test:e2e
pnpm test:e2e:ui
pnpm test:e2e:update-snapshots
SpecWhat
auth.spec.tsSignup, login, magic link
browse.spec.tsTopic/scripture/emotion browse
checkout.spec.tsPremium subscription checkout
content-gating.spec.tsFree vs premium content access
illustration-detail.spec.tsIllustration detail page
favorites.spec.tsSave/unsave illustrations
lenslines.spec.tsTheological lens filtering
responsive.spec.tsMobile/tablet layout
crud-*.spec.tsAuth, checkout, contact, favorites, profile, search CRUD
audit.spec.tsContent audit checks
delivers/01–05Full lifecycle: discovery → browse → free use → premium → daily use

Tag Filtering (CWA E2E)

npx playwright test --grep "@theological"
npx playwright test --grep "@lifecycle"
npx playwright test --grep "@live" # requires real API calls
npx playwright test --grep-invert "@live" # skip AI API calls (faster)
npx playwright test --grep "@known-bug" # expected failures
npx playwright test --grep "@cross-property" # multi-domain

Known-Bugs Specs

Tests in delivers/known-bugs/ across all codebases use test.fixme(). They document confirmed UX issues and serve as regression guards — when a bug is fixed, the test should be changed to test() and moved out of known-bugs/.

Current documented bugs:

  • cwa-demo-phone-labels.spec.ts — Demo page phone label copy issue
  • cwa-no-post-signup-explanation.spec.ts — No explanation after onboard signup
  • cwa-pricing-paralysis.spec.ts — Pricing page causes decision paralysis
  • itw-irrelevant-on-this-day.spec.ts — "On This Day" content not always relevant
  • pewsearch-search-returns-all.spec.ts — Search with empty query returns all results
  • sermonwise-homily-missing.spec.ts — Homily content type missing from SermonWise

See Also