GuidesEnd-to-end testing

Your first 10 tests

Expand from one flow to 10 core tests across your product domains, spot overlapping setup early, and start creating users programmatically.

In Set up a Playwright suite, you got one flow you would be embarrassed to break running on every pull request. That proves the setup works and protects one critical path, but it still leaves most of your product unchecked.

Going from 1 test to 10 is how you build real baseline confidence across the main parts of your app. You need a working Playwright suite running on Endform (using Playwright Intent or plain Playwright). You can follow along on your own app or inspect the complete BikeBook suite in suites/02-first-10-tests.

This guide takes you from 10 tests that each sign up through the UI to 10 tests that start from a programmatic user:

0s2s4s6s8s10sAll 10 browsers done at 10.5sSign up in the UI ×10Add a bike in the UI ×7Book a bike ×3Sign upSign in and outDelete an accountInvite a teammateAdd bikesRemove a bikeReject duplicatesBook a bikeCancel a bookingBlock double-booking
  • Setup in the UI
  • Setup via API
  • Flow under test

64% of test time is setup · illustrative timings

Pick 10 flows across your core domains

Rather than walking through routes one by one, divide your product into three or four core domains and list the two to four flows in each domain that users rely on every day.

In BikeBook, an office bike-booking app, the product splits cleanly into three domains:

User management and auth
4 flows
  • Sign up and land on the dashboard
  • Sign in and sign out from the user menu
  • Delete an account and confirm it can no longer sign back in
  • Invite a teammate who joins and books a bike
Fleet management
3 flows
  • Add bikes and list them with their type
  • Remove a bike and clear its bookings
  • Reject duplicate bike names when adding a bike
Bookability
3 flows
  • Book a bike and see it in upcoming bookings and activity
  • Cancel a booking to free the slot
  • Block double-booking when two browsers pick the same slot

Every product's domains look different, but the shape is similar. An e-commerce app might split into catalog and search, cart and checkout, and account and orders. Aim for 8 to 10 flows that cover the core promise of your product plus a couple of important error cases.

Spot the overlap before writing all 10

Start by writing the first three tests, one from each domain. Here is the bookability one, which books a bike for next week. Hover or click an ai.do(...) line to inspect its compiled Playwright code:

tests/bookings.spec.ts (with UI sign-up)
import { expect, test } from "playwright-intent"; test("users can book a bike and see it in their upcoming bookings", async ({  page,  ai,}) => {  const email = `user-${Date.now()}-${Math.random().toString(36).slice(2, 8)}@example.com`;   await page.goto("/sign-up");   await page.goto(`/dashboard?date=${nextWeek()}`);   await expect(page.getByRole("status")).toContainText("Booked Road 1");  await expect(page.getByRole("row", { name: /Road 1/ })).toContainText(    "Booked by you",  );  await expect(    page.getByRole("listitem").filter({ hasText: "Road 1" }),  ).toContainText("morning");   await page.getByRole("link", { name: "Activity" }).click();  await expect(page.getByText(/You booked Road 1/)).toBeVisible();}); function nextWeek() {  const day = new Date();  day.setUTCDate(day.getUTCDate() + 7);  return day.toISOString().slice(0, 10);}

The fleet and user management tests start the same way. All three sign up a new user through /sign-up before they ever reach the feature they are meant to check.

If you keep going and write all 10 tests that way, your suite ends up looking like this:

Ten tests where every row starts with a wide Sign up in UI block taking roughly 40% of total test time before reaching the flow under test

Repeating sign-up in every test causes two problems right away:

  • You spend a third to almost half of your test time signing users in. Every test pays the full cost of loading /sign-up, filling the form, and waiting for redirects before doing the work you actually wrote it for.
  • Failures stop telling you what broke. If the sign-up form changes or breaks, tests in fleet management and bookability go red even though booking and fleet management still work. Earlier setup failures hide the signal you want from the rest of the suite.

Scaling from 1 test to 10 is mostly about noticing where your flows overlap and removing the biggest shared setup early. In almost every web app, the first overlap worth removing is creating a signed-in user.

Start non-auth tests from a programmatic user

Keep dedicated tests that drive your real sign-up and sign-in UI so you still have full confidence in authentication. In BikeBook, the two auth tests in tests/users.spec.ts run through /sign-up, /sign-in, and sign-out by themselves.

For the other eight tests (account deletion, team invites, fleet management, and bookability), skip the sign-up form entirely: create a fresh, isolated user through an internal test endpoint, set their session cookie on the browser context, and delete the user when the test finishes.

In BikeBook, a small extended fixture in tests/test-with-new-user.ts exports testWithNewUser, which creates a fresh signed-in user before each test and cleans it up afterwards:

tests/test-with-new-user.ts (excerpt)
import { test as base } from "playwright-intent";

export const testWithNewUser = base.extend<{ newUser: User }>({
  newUser: [
    async ({ request, context, baseURL }, use) => {
      const user = await createUser(request);
      await context.addCookies([
        sessionCookie(user.session, baseURL as string),
      ]);
      await use(user);
      await deleteUser(request, user.email);
    },
    { auto: true },
  ],
});

Here is the same booking test written with testWithNewUser. The sign-up step is gone, and the test starts on the dashboard as a signed-in user:

tests/bookings.spec.ts
import { expect, testWithNewUser } from "./test-with-new-user"; testWithNewUser(  "users can book a bike and see it in their upcoming bookings",  async ({ page, ai }) => {    await page.goto(`/dashboard?date=${nextWeek()}`);     await expect(page.getByRole("status")).toContainText("Booked Road 1");    await expect(page.getByRole("row", { name: /Road 1/ })).toContainText(      "Booked by you",    );    await expect(      page.getByRole("listitem").filter({ hasText: "Road 1" }),    ).toContainText("morning");     await page.getByRole("link", { name: "Activity" }).click();    await expect(page.getByText(/You booked Road 1/)).toBeVisible();  },); function nextWeek() {  const day = new Date();  day.setUTCDate(day.getUTCDate() + 7);  return day.toISOString().slice(0, 10);}

Now the suite looks very different. Two tests still exercise authentication through the UI, while the other eight start straight from a signed-in user and spend almost all of their time testing the actual behavior they are named after:

Ten tests split into two auth UI tests and eight tests that create a user via API and start signed in, spending most of their time on the flow under test

Click any file below to inspect the full 10-test suite in BikeBook:

BikeBook first 10 tests (suites/02-first-10-tests)
4 files+291

Run all 10 tests on Endform

Run the suite on Endform with each test repeated three times, which checks that no test depends on the order or data of another:

npx endform@latest test --repeat-each=3

All 30 runs should pass. Because each test creates and cleans up its own user, they run in parallel across separate machines without colliding. On your first run with new ai.do(...) steps, Playwright Intent generates the .intent/ TypeScript files; commit them alongside your tests so pull-request checks replay with zero model calls.

Here is today's scheduled run of these 10 tests in Endform:

10 tests · clean app

What still overlaps

Most of the eight tests that start from testWithNewUser still add a bike through the Manage fleet UI before booking or removing it. At 10 tests, that is fast and keeps the setup simple. Once your suite grows past 20 tests, apply the same programmatic setup to domain data, like seeding a fleet, and pair it with a flake routine. Both are covered in From 10 to 100 tests.

Last updated