Skip to main content

Documentation Index

Fetch the complete documentation index at: https://grantmaster.dev/llms.txt

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

E2E Testing Framework

Role of E2E Tests

End-to-End (E2E) tests simulate actual user journeys across the entire stack, verifying the interplay between the frontend React application, the API/backend services, the database, and third-party integrations (mocked or sandboxed). They are GrantMaster’s final line of defense against critical regressions.

Tools Summary

  • Playwright / Cypress: Used for automating interactions within browser contexts.
  • Jest / Vitest: For executing and managing the test suites and assertions.
  • MSW (Mock Service Worker): For deterministic interception of specific third-party API calls (e.g., Stripe) during scenarios where live endpoints are too expensive or flaky.
  • Faker.js: Used for generating realistic synthetic data (e.g., mock grant names, realistic emails, mock company URLs).

The Core Test Suites

1. Happy Path: Grant Lifecycle E2E

The absolute core competency of the software. If this fails, no deployment can occur.
  • Authentication: Login as a standard ‘Member’ and switch tenant contexts.
  • Creation: Create a draft grant from a mock document via the Document Brain.
  • Editing & Collaboration: Edit the grant summary and manually assign a task to another user via the CommandPalette.
  • Workflow Transitions: Advance the grant status from DRAFT to SUBMITTED.
  • Export / Reporting: Export the grant to PDF and verify the network response returns a file blob.

2. Billing & Subscription Edge Cases

  • Upgrade Flow: Attempt an upgrade with a mocked Stripe checkout window success response.
  • Quota Constraints: Actively use up AI credits until the quota ceiling is reached and verify that the UI surfaces a “payment required/credits depleted” dialog box, explicitly preventing further AI requests.

3. Permissions & Security Enforcement (RBAC)

  • Unauthorized Access: Log in as Read-Only Auditor and attempt to click “Delete Grant” -> Assert the button is either hidden, disabled, or an attempt to use the URL directly returns a generic 403 Forbidden modal without leaking details.
  • Data Isolation: Ensure tenant A cannot load tenant B’s grants via deep link.

Deployment Gates and CI Execution

  • E2E tests must be hermetic. They create a new logical tenant space in the target staging environment before they run and destroy all generated test data upon completion.
  • If the happy_path_core.spec.ts suite fails in CI, the build fails and deployment halts immediately. No exceptions.