For E2E testing supastarter integrates a basic setup of [Playwright](https://playwright.dev). Playwright is a great open-source tool for e2e testing. It's easy to use and has a great developer experience. It's fast, mature and reliable. You can also use it for component (unit) testing. ## Running e2e tests To run the e2e tests in your local environment, run the command for the app you are working on: ```bash pnpm --filter saas e2e # or pnpm --filter marketing e2e ``` This will start up the development server of your application (if it's not already running) and also open the Playwright UI. In the UI you can see all available tests and run them. ![Playwright UI](/images/documentation/e2e/playwright-ui.png) ## Running e2e tests headlessly Pull request CI no longer runs Playwright. Use the headless scripts locally (or wire them into your own workflow): ```bash pnpm --filter saas e2e:ci # or pnpm --filter marketing e2e:ci ``` These commands install Playwright browsers and run against a production build. A database is required for SaaS suites — set `DATABASE_URL` (and any other secrets from your `.env.local`, such as `STRIPE_SECRET_KEY` when testing Stripe). ## Writing e2e tests The e2e tests are located in the app that owns the surface under test: - `apps/marketing/tests` - `apps/saas/tests` To create a new test suite, create a new `*.spec.ts` file in the correct folder: ```ts copy import { expect, test } from "@playwright/test"; test.describe("some feature", () => { test("should do something", async ({ page }) => { await page.goto("/app/feature-page"); await expect( page.getByRole("heading", { name: "Amazing feature" }), ).toBeVisible(); }); }); ``` Playwright will then automatically pick up the test suite and run it. Learn more about writing e2e tests [in the Playwright documentation](https://playwright.dev/docs/writing-tests).