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.

Purpose: Run AI-powered autonomous tests (frontend E2E and backend API) via the TestSprite MCP server in Cursor. Docs: TestSprite MCP – Installation, First MCP Test.

Prerequisites


1. Install TestSprite MCP in Cursor

TestSprite is provided as an example entry in .cursor/mcp.json.example. Configure it locally with your own API key:
  1. Open Cursor Settings (e.g. Ctrl+Shift+J / Cmd+Shift+J).
  2. Go to Tools & IntegrationAdd custom MCP (or edit existing MCP config).
  3. Add or update a TestSprite MCP entry with your real API key:
    • Replace YOUR_TESTSPRITE_API_KEY in the env.API_KEY field with your key from the dashboard.
    • Do not commit real API keys. Use a local override or Cursor’s env/secrets if available.
  4. Restart Cursor if needed; confirm the TestSprite MCP server shows as connected (green).
Cursor sandbox: For full TestSprite behavior, set ChatAuto-RunAuto-Run Mode to Ask Every time or Run Everything (see Cursor Sandbox Mode).

2. Prepare the app

  • Frontend (development): From repo root run npm run dev (app on port 8080). TestSprite will limit to 15 high-priority tests in dev mode.
  • Frontend (production, recommended for stable runs): Run npm run build && npm run preview. Confirm the app loads at http://localhost:8080. When calling testsprite_generate_code_and_execute, set serverMode: "production" so all tests run and the app is more stable (no HMR during login).
  • Backend/API: If testing APIs, ensure your backend is running and reachable (e.g. Supabase + edge functions per project setup).
  • Have a test user (e.g. from .env.local / Lovable secrets) for login if testing authenticated flows.

3. Run tests with TestSprite

  1. Open a new Cursor Chat.
  2. Type: “Can you test this project with TestSprite?”
  3. Optionally drag the project folder (or a subfolder) into the chat.
  4. When the Testing Configuration page opens in the browser, set:
    • Testing type: Frontend (UI) and/or Backend (APIs).
    • Scope: Code Diff (recent changes) or Codebase (full).
    • Test credentials: e.g. TEST_USER_ADMIN_EMAIL / TEST_USER_ADMIN_PASSWORD if your app requires login.
    • Application URLs: e.g. Frontend http://localhost:8080, Backend URL if applicable.
    • PRD: Upload an existing product/requirements doc (draft is fine); TestSprite will normalize it.
  5. Let the assistant run the TestSprite tools; it will generate a test plan, run tests in the cloud, and produce reports.
Auth and additionalInstruction: Our app uses Supabase auth with an async redirect after Sign In. To avoid most login-related failures, when the assistant calls testsprite_generate_code_and_execute, ask it to pass additionalInstruction with: “After clicking Sign In, wait at least 8 seconds for the Supabase auth redirect to complete before interacting with the page again. The app redirects to /dashboard after successful login. Do NOT retry login if the URL still shows /auth within the first 10 seconds — the redirect is async.” A copy of this text is in testsprite_tests/additional_instruction_auth.txt (inside the gitignored testsprite_tests/ folder) for reference.

4. Where results go

After a run, look for:
  • testsprite_tests/ in the project (folder is gitignored):
    • testsprite-mcp-test-report.md or TestSprite_MCP_Test_Report.md – human-readable report.
    • tmp/test_results.json, tmp/config.json, generated test files (e.g. TC001_*.py).
  • Use the report to see pass rate, failures, and suggested fixes.
To ask for automatic fixes: “Please fix the codebase based on TestSprite testing results.”

5. Ensure everything is running (checklist)

Before running TestSprite, confirm the following. Before running TestSprite:
  1. Node.js: Run node --version — must be >= 22 (TestSprite requirement).
  2. App: Run npm run dev (development) or npm run build && npm run preview (production). Confirm the app loads at http://localhost:8080. For production mode, tell the assistant to use serverMode: "production" when calling generate_code_and_execute.
  3. MCP: In Cursor Settings → MCP, confirm TestSprite shows connected (green). Set API_KEY in the TestSprite server config. Use .cursor/mcp.json.example as a template and keep API keys environment-based. If your API key was ever committed, rotate it at TestSprite Dashboard → Settings → API Keys.
  4. Cursor sandbox: Verify ChatAuto-RunAuto-Run Mode is Ask Every Time or Run Everything (see Cursor Sandbox Mode).
  5. First-time only: If testsprite_tests/ does not exist or is empty, run the bootstrap step (e.g. in Cursor chat: “Can you test this project with TestSprite?” and complete the browser config). This creates testsprite_tests/tmp/config.json and later standard_prd.json and tmp/code_summary.yaml.

Before execute (important):

The TestSprite CLI expects testsprite_tests/testsprite_frontend_test_plan.json. That file is created when the Cursor assistant calls the generate frontend test plan MCP tool (e.g. as part of “Can you test this project with TestSprite?”). So:
  • In Cursor chat, run the full TestSprite flow so that the assistant calls testsprite_generate_frontend_test_plan (with your project path and needLogin: true). After that, testsprite_frontend_test_plan.json should appear under testsprite_tests/.
  • Then run testsprite_generate_code_and_execute (or the CLI command the assistant suggests). Do not run execute until the test plan file exists.
Optional verification: Before execute, check that these exist:
  • testsprite_tests/tmp/config.json
  • testsprite_tests/standard_prd.json
  • testsprite_tests/testsprite_frontend_test_plan.json
Note: testsprite_tests/ is in .gitignore so generated reports and config are not committed and API keys/credentials stay out of the repo.

Quick reference

  • Get API key: Dashboard → Settings → API Keys
  • Set key in Cursor: Use .cursor/mcp.json.example template and set env.API_KEY locally in Cursor MCP config
  • Node.js: Run node --version — must be >= 22
  • Start app (dev): npm run dev (port 8080); tests limited to 15 in dev mode
  • Start app (prod): npm run build && npm run preview; use serverMode: "production" for full runs
  • Auth instruction: Pass additionalInstruction with wait-after-Sign-In text (see §3) or use testsprite_tests/additional_instruction_auth.txt
  • Trigger test: In chat: “Can you test this project with TestSprite?”
  • Configure: Browser form: type, scope, credentials, URLs, PRD

Troubleshooting

IssueFix
MCP server not connectingCheck Cursor Settings → Tools & Integration (or MCP); restart Cursor; verify TestSprite shows connected. See §1. Install TestSprite MCP.
API key rejectedConfirm env.API_KEY in MCP config matches a key from TestSprite Dashboard → Settings → API Keys. Ensure the key is not committed to the repo.
Missing testsprite_frontend_test_plan.jsonRerun the flow so the Cursor assistant calls testsprite_generate_frontend_test_plan; verify testsprite_tests/ contains the file. See §3. Run tests and §5 Before execute.
Port 8080 unreachableEnsure npm run dev (or npm run build && npm run preview) is running and the app loads at http://localhost:8080. See §2. Prepare the app.

See also: docs/testing/index.md for Vitest, Playwright, and RLS testing.