Skip to main content

Documentation Index

Fetch the complete documentation index at: https://docs.encoreos.io/llms.txt

Use this file to discover all available pages before exploring further.

Document Type: PRD
Product: TestSprite integration for Encore Health OS
Version: 1.0.0
Last Updated: 2026-03-10
Status: Draft

1. Overview

1.1 Purpose

This PRD defines the product requirements for TestSprite integration within the Encore Health OS platform. TestSprite provides AI-powered autonomous testing (frontend E2E and backend API) via an MCP (Model Context Protocol) server in Cursor, enabling developers and AI assistants to generate test plans, execute tests in the cloud, and consume structured reports without maintaining large hand-written E2E suites for every change.

1.2 Scope

  • In scope: Use of TestSprite MCP in Cursor for frontend (UI) and backend (API) test generation and execution; configuration, workflows, and consumption of test reports for this repository.
  • Out of scope: TestSprite’s internal product roadmap; replacement of existing Vitest/Playwright/RLS test suites; CI/CD integration (future phase).

1.3 References


2. Goals and Success Criteria

2.1 Goals

GoalDescription
Faster feedbackEnable AI-assisted and developer-triggered autonomous test runs (frontend and backend) without writing full E2E test code upfront.
Coverage discoveryUse AI-generated test plans to discover high-value scenarios and gaps relative to product behavior.
Regression signalGet a clear pass/fail and failure report after changes to prioritize fixes.
Single workflowAlign “run tests” with the existing Cursor + MCP workflow (e.g. “Can you test this project with TestSprite?”).

2.2 Success Criteria

CriterionMeasure
Setup completionA new developer with Node ≥22 and a TestSprite account can run a first TestSprite test within one session using TESTSPRITE.md.
Run reliabilityWith app running (dev or production) and correct auth instructions, TestSprite runs complete and produce a report (pass/fail and failure details).
Actionable reportsReports (e.g. testsprite-mcp-test-report.md / TestSprite_MCP_Test_Report.md) are sufficient for an AI or developer to identify failing flows and apply fixes.
SecurityAPI keys and credentials are not committed; testsprite_tests/ remains gitignored; key rotation is documented.

3. User Personas and Use Cases

3.1 Personas

PersonaDescriptionPrimary need
DeveloperEngineer working in Cursor on Encore Health OSRun autonomous tests after changes; get a quick regression signal.
AI assistantCursor AI using TestSprite MCP toolsBootstrap config, generate test plans, execute tests, and interpret reports to suggest or apply fixes.
QA / releaseValidator before releaseRun full (e.g. production-mode) TestSprite suite and use report for go/no-go.

3.2 Use Cases

IDUse caseTriggerOutcome
UC-1First-time setupNew machine or new contributorTestSprite MCP configured; first bootstrap and test run successful.
UC-2Ad-hoc frontend test runDeveloper or AI: “Can you test this project with TestSprite?”Test plan generated; tests executed; report saved under testsprite_tests/.
UC-3Frontend test with authSame as UC-2 with login requiredAuth credentials and additionalInstruction (e.g. Supabase redirect wait) applied; login flow tested.
UC-4Production-mode full runDeveloper wants full test set, stable environmentApp run with npm run build && npm run preview; serverMode: "production" used; full test set executed.
UC-5Backend/API test runUser selects backend testing in configBackend test plan generated and executed; API test results in report.
UC-6Fix from reportAfter a failed runDeveloper or AI uses report to fix failures; optionally re-runs tests to confirm.
UC-7Rerun subsetRe-run specific test IDstestsprite_rerun_tests (or equivalent) used with selected test IDs; updated report.

4. Functional Requirements

4.1 Configuration and Bootstrap

IDRequirementPriority
FR-1Project MUST be bootstrapped once via TestSprite (e.g. testsprite_bootstrap) when no config exists; bootstrap MUST NOT be re-run when config already exists.Must
FR-2Bootstrap SHALL accept: project path, local port (e.g. 8080), pathname (optional), type (frontendbackend), test scope (codebasediff).Must
FR-3Generated config (e.g. testsprite_tests/tmp/config.json) SHALL be gitignored.Must
FR-4API key SHALL be provided via MCP env (e.g. env.API_KEY); SHALL NOT be committed to the repo.Must

4.2 Test Plan Generation

IDRequirementPriority
FR-5Frontend test plan SHALL be generatable via MCP (e.g. testsprite_generate_frontend_test_plan) with project path and needLogin.Must
FR-6Backend test plan SHALL be generatable via MCP (e.g. testsprite_generate_backend_test_plan) with project path.Should
FR-7Test plan output (e.g. testsprite_tests/testsprite_frontend_test_plan.json) SHALL exist before execute is called; execute SHALL depend on it.Must
FR-8A standardized PRD MAY be generated (e.g. testsprite_generate_standardized_prd) for TestSprite to normalize requirements; optional upload in config.Could

4.3 Test Execution

IDRequirementPriority
FR-9Execute SHALL require: local app running (dev or production), existing test plan, project path and name.Must
FR-10Execute SHALL support serverMode: development (limited frontend tests, e.g. 15) or production (full set).Must
FR-11Execute SHALL accept optional additionalInstruction (e.g. Supabase auth redirect wait) for stable auth flows.Must
FR-12Execute SHALL support optional testIds to run a subset of the plan.Should
FR-13Execute SHALL produce a human-readable report (e.g. markdown) and machine-readable artifacts under testsprite_tests/.Must

4.4 Reports and Follow-up

IDRequirementPriority
FR-14Report SHALL include pass/fail summary and failure details sufficient to locate and fix issues.Must
FR-15User MAY request “fix the codebase based on TestSprite results”; AI SHALL use report and codebase to propose or apply fixes.Should
FR-16User MAY open TestSprite test result dashboard (e.g. testsprite_open_test_result_dashboard) when supported.Could
FR-17User MAY check account info (e.g. testsprite_check_account_info) for quota/limits.Could

4.5 Application and Environment

IDRequirementPriority
FR-18Frontend tests SHALL run against a running app at a configured URL (e.g. http://localhost:8080).Must
FR-19When login is required, test credentials (e.g. from .env.local or Lovable secrets) SHALL be configurable in TestSprite config; credentials SHALL NOT be committed.Must
FR-20Backend/API tests SHALL run against a running backend (e.g. Supabase + edge functions) when backend type is selected.Should

5. Non-Functional Requirements

5.1 Security and Compliance

IDRequirementPriority
NFR-1TestSprite API key SHALL be stored only in local MCP config or env; SHALL NOT appear in repo or logs.Must
NFR-2If an API key is ever committed, it SHALL be rotated immediately via TestSprite Dashboard.Must
NFR-3Generated artifacts under testsprite_tests/ (config, reports, plans) SHALL remain in .gitignore to avoid leaking credentials or internal test data.Must
NFR-4Test credentials (e.g. test user email/password) SHALL be provided via secure env or secrets, not hardcoded.Must

5.2 Usability and Documentation

IDRequirementPriority
NFR-5A single setup doc (TESTSPRITE.md) SHALL cover: prerequisites, MCP install, app preparation, run workflow, auth instruction, result locations, troubleshooting.Must
NFR-6Checklist “Before running TestSprite” SHALL be documented (Node ≥22, app running, MCP connected, sandbox mode, bootstrap when needed, test plan present).Must
NFR-7Auth-specific instruction (e.g. 8–10 second wait after Sign In for Supabase redirect) SHALL be documented and passable as additionalInstruction.Must

5.3 Compatibility and Dependencies

IDRequirementPriority
NFR-8Node.js version SHALL be ≥22 for TestSprite tooling.Must
NFR-9Cursor Auto-Run (sandbox) SHALL be set to “Ask Every time” or “Run Everything” for full TestSprite behavior.Must
NFR-10Default app port SHALL be 8080 (Vite dev/preview); bootstrap and docs SHALL reflect this.Must

6. User Flows (High Level)

6.1 First-Time Setup

  1. Developer installs Node ≥22 and creates TestSprite account.
  2. Developer adds TestSprite MCP in Cursor with API key in env.
  3. Developer runs “Can you test this project with TestSprite?” (or equivalent).
  4. AI runs bootstrap (no config yet); user completes browser config (type, scope, credentials, URLs, optional PRD).
  5. Config and (after plan generation) test plan files appear under testsprite_tests/.
  6. First execute produces a report.

6.2 Subsequent Frontend Test Run (with login)

  1. Developer starts app: npm run dev or npm run build && npm run preview.
  2. Developer (or AI) triggers TestSprite test run with auth credentials and additionalInstruction for Supabase redirect.
  3. AI generates frontend test plan (if needed) then calls generate_code_and_execute.
  4. TestSprite runs tests; report is written to testsprite_tests/.
  5. Developer or AI reads report and optionally applies fixes and re-runs.

6.3 Production-Mode Full Run

  1. Developer runs npm run build && npm run preview and confirms app at http://localhost:8080.
  2. Developer asks AI to run TestSprite with serverMode: "production".
  3. Full test set runs; report is generated.
  4. Report used for release sign-off or fix list.

7. Out of Scope (Current Phase)

  • CI/CD integration (e.g. GitHub Actions calling TestSprite).
  • Replacing or merging existing Vitest/Playwright/RLS suites with TestSprite.
  • TestSprite product features not exposed via current MCP tools.
  • Commitment to a specific TestSprite pricing tier or quota.

8. Dependencies and Constraints

8.1 Dependencies

  • TestSprite cloud service and MCP server availability.
  • Cursor IDE with MCP support.
  • Node.js ≥22.
  • Running Encore Health OS frontend (and optionally backend) during test execution.
  • TestSprite account and valid API key.

8.2 Constraints

  • Test plan file must exist before execute (generated in same flow or previous run).
  • Auth flows require explicit wait instruction for async redirect (Supabase).
  • Dev mode limits frontend tests (e.g. 15) to avoid overload; production mode for full set.
  • testsprite_tests/ is gitignored; no in-repo history of reports or config.

9. Open Questions and Future Work

TopicQuestion / Future work
CI integrationHow to trigger TestSprite from GitHub Actions (or other CI) with secrets and running app?
PRD normalizationWhen to use testsprite_generate_standardized_prd and how to maintain a project PRD for TestSprite?
Backend coverageWhich backend/API surfaces are in scope for TestSprite backend plans?
Quota and limitsHow to surface TestSprite account/quota (e.g. testsprite_check_account_info) in runbooks?
Report retentionPolicy for local report retention and cleanup under testsprite_tests/.

10. Approval and Revision History

VersionDateAuthorChanges
1.0.02026-03-10Initial PRD for TestSprite integration.

See also: TESTSPRITE.md for setup and runbooks; README.md for the testing pyramid and other test types.