Skip to main content

Frontend development · Intermediate · 28 min

Write end-to-end browser tests with Playwright

By Padding · Updated 18 Nov 2026
Node.js 26.13 · Playwright 1.65.1 · Vite 8.3.8 · checked on node:26 in Chromium and Firefox

You will have a Playwright suite that starts a Vite shop with vite preview, tests its sign-in and checkout journeys in headless Chromium and Firefox with role-based locators and a mocked API, and leaves a trace you can open when a test fails.

On this page

Unit tests prove that a function returns the right value. They do not prove that a person can open your site, sign in and pay. End-to-end tests do that: they start the real build, open a real browser, click and type the way a user does, and check what appears on screen. Playwright is a good fit for this because one test file runs unchanged in Chromium, Firefox and WebKit, and because its locators and assertions wait for the page on their own, so you never guess a delay.

In this tutorial you test Sokoni Market, a small fictional shop built with Vite and plain JavaScript. A customer signs in, adds products to a basket and places an order for delivery. The shop talks to two API endpoints, /api/session and /api/orders, that do not exist yet. Your tests stand in for them, which keeps the suite fast, free and independent of any backend.

By the end you have:

  • Playwright 1.65.1 in a Vite 8 project, set up with npm init playwright
  • a webServer setting that builds the app and starts vite preview before the tests
  • tests for sign-in and checkout written with role-based locators and web-first assertions
  • every test running headless in Chromium and Firefox
  • a trace from a failing test, and a run that behaves the way it will in CI

Step 1 · Build the shop you will test

Make a demo folder with a package.json, a page and a script. If you already have a Vite project you can follow along in it, but the tests below depend on the exact labels and text in this page.

Bash
mkdir -p ~/playwright-e2e-demo
cd ~/playwright-e2e-demo
cat > package.json <<'JSON'
{
  "name": "sokoni-market",
  "private": true,
  "type": "module",
  "scripts": {
    "dev": "vite",
    "build": "vite build",
    "preview": "vite preview",
    "test:e2e": "playwright test"
  }
}
JSON
npm install --save-dev vite@8.3.8

The page has three sections. Only the sign-in form shows at first; the shop and the confirmation appear as the customer moves through.

Bash
cd ~/playwright-e2e-demo
cat > index.html <<'HTML'
<!doctype html>
<html lang="en">
  <head>
    <meta charset="utf-8">
    <meta name="viewport" content="width=device-width, initial-scale=1">
    <title>Sokoni Market</title>
  </head>
  <body>
    <main>
      <h1>Sokoni Market</h1>

      <section id="sign-in" aria-labelledby="sign-in-heading">
        <h2 id="sign-in-heading">Sign in</h2>
        <form id="sign-in-form">
          <p><label for="email">Email</label><br><input id="email" name="email" type="email" autocomplete="email" required></p>
          <p><label for="password">Password</label><br><input id="password" name="password" type="password" autocomplete="current-password" required></p>
          <p id="sign-in-error" role="alert" hidden></p>
          <button type="submit">Sign in</button>
        </form>
      </section>

      <section id="shop" aria-labelledby="shop-heading" hidden>
        <p id="welcome"></p>
        <h2 id="shop-heading">Products</h2>
        <ul id="products" aria-labelledby="shop-heading"></ul>
        <p id="basket-summary" role="status">Your basket is empty</p>

        <h2>Delivery details</h2>
        <form id="checkout-form">
          <p><label for="full-name">Full name</label><br><input id="full-name" name="name" autocomplete="name" required></p>
          <p><label for="phone">Phone number</label><br><input id="phone" name="phone" type="tel" autocomplete="tel" required></p>
          <p><label for="address">Delivery address</label><br><textarea id="address" name="address" rows="2" required></textarea></p>
          <p id="checkout-error" role="alert" hidden></p>
          <button type="submit">Place order</button>
        </form>
      </section>

      <section id="confirmation" hidden>
        <h2>Order confirmed</h2>
        <p id="confirmation-text"></p>
      </section>
    </main>
    <script type="module" src="/main.js"></script>
  </body>
</html>
HTML

The script keeps the basket in a Map, adds a flat KSh 250 delivery fee and calls the two endpoints with fetch. It shows a different message when the server says no and when the network fails, because on a patchy mobile connection the second happens often.

Bash
cd ~/playwright-e2e-demo
cat > main.js <<'JS'
const products = [
  { id: 'rooibos', name: 'Rooibos tea, 250 g', price: 450 },
  { id: 'shea', name: 'Shea butter, 200 ml', price: 650 },
  { id: 'coffee', name: 'Coffee beans, 500 g', price: 1200 },
];
const DELIVERY_FEE = 250;
const basket = new Map();
const $ = (id) => document.getElementById(id);
const ksh = (amount) => `KSh ${amount.toLocaleString('en-US')}`;

function totals() {
  let count = 0;
  let subtotal = 0;
  for (const [id, quantity] of basket) {
    count += quantity;
    subtotal += quantity * products.find((p) => p.id === id).price;
  }
  return { count, total: count ? subtotal + DELIVERY_FEE : 0 };
}

function renderBasket() {
  const { count, total } = totals();
  $('basket-summary').textContent = count === 0
    ? 'Your basket is empty'
    : `${count} ${count === 1 ? 'item' : 'items'} · ${ksh(total)} with delivery`;
}

function renderProducts() {
  $('products').replaceChildren(...products.map((product) => {
    const item = document.createElement('li');
    const label = document.createElement('span');
    label.textContent = `${product.name} · ${ksh(product.price)} `;
    const add = document.createElement('button');
    add.type = 'button';
    add.textContent = 'Add to basket';
    add.addEventListener('click', () => {
      basket.set(product.id, (basket.get(product.id) ?? 0) + 1);
      renderBasket();
    });
    item.append(label, add);
    return item;
  }));
}

function showError(id, message) {
  $(id).textContent = message;
  $(id).hidden = false;
}

async function postJson(url, body) {
  return fetch(url, {
    method: 'POST',
    headers: { 'content-type': 'application/json' },
    body: JSON.stringify(body),
  });
}

$('sign-in-form').addEventListener('submit', async (event) => {
  event.preventDefault();
  $('sign-in-error').hidden = true;
  const form = new FormData(event.target);
  const button = event.submitter;
  button.disabled = true;
  let response;
  try {
    response = await postJson('/api/session', { email: form.get('email'), password: form.get('password') });
  } catch {
    showError('sign-in-error', 'Could not reach the server. Check your connection and try again.');
    return;
  } finally {
    button.disabled = false;
  }
  if (!response.ok) {
    showError('sign-in-error', 'That email and password do not match.');
    return;
  }
  const { name } = await response.json();
  $('welcome').textContent = `Signed in as ${name}`;
  $('sign-in').hidden = true;
  $('shop').hidden = false;
});

$('checkout-form').addEventListener('submit', async (event) => {
  event.preventDefault();
  $('checkout-error').hidden = true;
  const { count, total } = totals();
  if (count === 0) {
    showError('checkout-error', 'Add something to your basket first.');
    return;
  }
  const form = new FormData(event.target);
  const response = await postJson('/api/orders', {
    name: form.get('name'),
    phone: form.get('phone'),
    address: form.get('address'),
    items: Object.fromEntries(basket),
    total,
  }).catch(() => null);
  if (!response?.ok) {
    showError('checkout-error', 'We could not place your order. Try again.');
    return;
  }
  const { id } = await response.json();
  $('confirmation-text').textContent = `Order ${id} · ${ksh(total)} with delivery. We will text ${form.get('phone')} when it leaves.`;
  $('shop').hidden = true;
  $('confirmation').hidden = false;
});

renderProducts();
JS
npm run build

Check it worked

npm run build ends with a line like ✓ built in 120ms, and ls dist shows index.html and an assets folder. Run npm run dev and open the address it prints: you see the Sokoni Market heading and a sign-in form. Signing in shows an error under the form, because no API answers yet. Stop the dev server with Ctrl+C before you go on.

Step 2 · Add Playwright with npm init playwright

npm init playwright runs the create-playwright package, which writes a config file, adds @playwright/test and @types/node to your dev dependencies and updates .gitignore. Run on its own it asks which language to use, where tests live, whether to add a GitHub Actions workflow and whether to install browsers (plus, on Linux, whether to install system dependencies). --quiet skips the questions and takes the defaults (a tests folder, no workflow); --lang=js picks JavaScript, --no-browsers skips the download and --no-examples leaves out the sample tests. With no sample tests it does not create the tests folder either, so make it yourself. create-playwright has its own version numbers, separate from Playwright's, so 1.17.139 here is not a typo.

Bash
cd ~/playwright-e2e-demo
npm init playwright@1.17.139 -- --quiet --lang=js --no-browsers --no-examples
mkdir -p tests

The initialiser installs whatever @playwright/test is newest that day. Pin the exact version, so your laptop, your teammates and CI run the same Playwright with the same browser builds:

Bash
cd ~/playwright-e2e-demo
npm install --save-dev --save-exact @playwright/test@1.65.1

Now download Chromium and Firefox. Each Playwright release is tied to specific browser builds, which is why this comes after the pin. On Linux, --with-deps also installs the system libraries the browsers need and may ask for your password; on macOS and Windows it has nothing extra to install.

Bash
cd ~/playwright-e2e-demo
npx playwright install --with-deps chromium firefox

The browsers go into a shared cache (~/.cache/ms-playwright on Linux, ~/Library/Caches/ms-playwright on macOS), not into the project, so other projects on the same Playwright version reuse them. That download is a few hundred megabytes. On prepaid mobile data, do it once on Wi-Fi and keep the cache.

Check it worked

npx playwright --version prints Version 1.65.1. The project now has a playwright.config.js and the empty tests folder you made, and package.json lists "@playwright/test": "1.65.1" with no ^ in front of it, next to @types/node, which the initialiser added for editor hints.

Step 3 · Start the app from the config with webServer

Replace the generated config with one written for this project. The webServer block is the important part: before any test runs, Playwright runs the command, waits until the URL answers, and stops the server when the tests finish. Testing vite preview rather than vite dev means you test the production build, the same files you would deploy.

Bash
cd ~/playwright-e2e-demo
cat > playwright.config.js <<'JS'
import { defineConfig, devices } from '@playwright/test';

const PORT = 4173;

export default defineConfig({
  testDir: './tests',
  fullyParallel: true,
  forbidOnly: !!process.env.CI,
  retries: process.env.CI ? 2 : 0,
  workers: process.env.CI ? 1 : undefined,
  reporter: [['list'], ['html', { open: 'never' }]],
  use: {
    baseURL: `http://127.0.0.1:${PORT}`,
    trace: 'on-first-retry',
  },
  projects: [
    { name: 'chromium', use: { ...devices['Desktop Chrome'] } },
    { name: 'firefox', use: { ...devices['Desktop Firefox'] } },
  ],
  webServer: {
    command: `npm run build && npm run preview -- --host 127.0.0.1 --port ${PORT} --strictPort`,
    url: `http://127.0.0.1:${PORT}`,
    reuseExistingServer: !process.env.CI,
    timeout: 120_000,
  },
});
JS

What each setting is for:

  • baseURL lets tests write page.goto('/') instead of a full address.
  • 127.0.0.1 rather than localhost avoids a machine resolving localhost to IPv6 for one program and IPv4 for another. --strictPort makes Vite fail loudly if the port is taken, instead of quietly moving to another port that Playwright is not watching.
  • reuseExistingServer is on locally, so a preview you already have running is used as is, and off in CI, so CI always tests a fresh build.
  • reporter prints a line per test and also writes an HTML report. open: 'never' stops the report from opening a browser and waiting after a failed run, which would hang a script.
  • projects runs every test once per browser.

Add a first test that only checks the page loads:

Bash
cd ~/playwright-e2e-demo
cat > tests/home.spec.js <<'JS'
import { test, expect } from '@playwright/test';

test('home page shows the sign-in form', async ({ page }) => {
  await page.goto('/');
  await expect(page).toHaveTitle('Sokoni Market');
  await expect(page.getByRole('heading', { name: 'Sign in' })).toBeVisible();
  await expect(page.getByRole('button', { name: 'Sign in' })).toBeEnabled();
});
JS
npx playwright test

Check it worked

The run builds the app, then prints one line per test and browser, something like ✓ 1 [chromium] › tests/home.spec.js:3:1 › home page shows the sign-in form, and ends with 2 passed. No browser window opens: Playwright runs headless unless you ask otherwise. Nothing is left listening afterwards; curl http://127.0.0.1:4173 fails to connect.

Step 4 · Test sign-in with role-based locators and a mocked API

A test should find things the way a person does: by what they are and what they say. getByRole('button', { name: 'Sign in' }) finds a button whose accessible name is Sign in. getByLabel('Email') finds the field joined to that label. These survive changes to class names and markup, and they fail when a label goes missing, which is a real bug for screen reader users too. Reach for CSS selectors and test IDs only when no role or label fits.

The shop calls /api/session, which does not exist on the preview server. page.route intercepts matching requests inside the browser and answers them from your test. Put the fake API and a sign-in helper in one file the tests share:

Bash
cd ~/playwright-e2e-demo
cat > tests/helpers.js <<'JS'
import { expect } from '@playwright/test';

// Only the mocked API below knows this account. Against a real staging
// server, read the password from an environment variable instead.
export const DEMO_USER = { email: 'amina@example.com', password: 'mock-only-password', name: 'Amina' };

export async function mockApi(page) {
  const orders = [];

  await page.route('**/api/session', async (route) => {
    const { email, password } = route.request().postDataJSON();
    // A slow answer, as on a weak mobile signal. The tests must cope without sleeps.
    await new Promise((resolve) => setTimeout(resolve, 800));
    if (email === DEMO_USER.email && password === DEMO_USER.password) {
      await route.fulfill({ json: { name: DEMO_USER.name } });
    } else {
      await route.fulfill({ status: 401, json: { error: 'invalid credentials' } });
    }
  });

  await page.route('**/api/orders', async (route) => {
    orders.push(route.request().postDataJSON());
    await route.fulfill({ status: 201, json: { id: `SK-${1041 + orders.length}` } });
  });

  return orders;
}

export async function signIn(page) {
  await page.goto('/');
  await page.getByLabel('Email').fill(DEMO_USER.email);
  await page.getByLabel('Password').fill(DEMO_USER.password);
  await page.getByRole('button', { name: 'Sign in' }).click();
  await expect(page.getByText(`Signed in as ${DEMO_USER.name}`)).toBeVisible();
}
JS

Playwright only treats files ending in .spec.js or .test.js as tests, so helpers.js is never run on its own. Now the sign-in tests:

Bash
cd ~/playwright-e2e-demo
cat > tests/auth.spec.js <<'JS'
import { test, expect } from '@playwright/test';
import { DEMO_USER, mockApi } from './helpers.js';

test.beforeEach(async ({ page }) => {
  await mockApi(page);
  await page.goto('/');
});

test('signs in with the right password', async ({ page }) => {
  await page.getByLabel('Email').fill(DEMO_USER.email);
  await page.getByLabel('Password').fill(DEMO_USER.password);
  await page.getByRole('button', { name: 'Sign in' }).click();

  await expect(page.getByText('Signed in as Amina')).toBeVisible();
  await expect(page.getByRole('heading', { name: 'Sign in' })).toBeHidden();
});

test('says so when the password is wrong', async ({ page }) => {
  await page.getByLabel('Email').fill(DEMO_USER.email);
  await page.getByLabel('Password').fill('not-the-password');
  await page.getByRole('button', { name: 'Sign in' }).click();

  await expect(page.getByRole('alert')).toHaveText('That email and password do not match.');
  await expect(page.getByLabel('Password')).toBeVisible();
});

test('explains when the network is down', async ({ page }) => {
  // Routes added later win, so this replaces the mock for this test only.
  await page.route('**/api/session', (route) => route.abort('internetdisconnected'));
  await page.getByLabel('Email').fill(DEMO_USER.email);
  await page.getByLabel('Password').fill(DEMO_USER.password);
  await page.getByRole('button', { name: 'Sign in' }).click();

  await expect(page.getByRole('alert')).toContainText('Could not reach the server');
});
JS
npx playwright test tests/auth.spec.js

Look at what is missing: there is no waitForTimeout, even though the mock takes 800 ms to answer. expect(locator).toBeVisible() and the other expect(locator) checks are web-first assertions. They retry until the condition holds or the expect timeout (5 seconds by default) runs out. Actions wait too, until the element is ready for that action: click() until it is visible, stable, receives events and is enabled, and fill() until it is visible, enabled and editable. A fixed sleep is either too short on a slow CI machine or wasted time on a fast one; let the assertion do the waiting.

The third test is worth keeping in any app used on mobile data: a dropped connection is a normal event, and the message the customer sees is part of the product.

Check it worked

The run ends with 6 passed: three tests in two browsers. Each sign-in test takes around a second, most of it the mock's deliberate delay. Change 'Signed in as Amina' in the first test to 'Signed in as Ama', run again, and that test still passes, because getByText with a string matches part of the text. Pass { exact: true } as a second argument to getByText when you need the whole text to match. Put the name back before you continue.

Step 5 · Test the checkout journey

The checkout test follows a customer from sign-in to confirmation. Two locator techniques carry it. getByRole('listitem').filter({ hasText: 'Rooibos tea' }) narrows the product list to one row, and .getByRole('button', { name: 'Add to basket' }) then finds the button inside that row only, even though every row has a button with the same text. And the orders array returned by mockApi holds what the page sent to /api/orders, so the test can check the request as well as the screen.

Bash
cd ~/playwright-e2e-demo
cat > tests/checkout.spec.js <<'JS'
import { test, expect } from '@playwright/test';
import { mockApi, signIn } from './helpers.js';

function addToBasket(page, productName) {
  return page
    .getByRole('listitem')
    .filter({ hasText: productName })
    .getByRole('button', { name: 'Add to basket' })
    .click();
}

async function fillDelivery(page) {
  await page.getByLabel('Full name').fill('Amina Wanjiru');
  await page.getByLabel('Phone number').fill('+254 712 345 678');
  await page.getByLabel('Delivery address').fill('Moi Avenue 14, Nairobi');
}

test('buys two products and sees the confirmation', async ({ page }) => {
  const orders = await mockApi(page);
  await signIn(page);

  await expect(page.getByRole('listitem')).toHaveCount(3);
  await addToBasket(page, 'Rooibos tea');
  await addToBasket(page, 'Shea butter');
  await expect(page.getByRole('status')).toHaveText('2 items · KSh 1,350 with delivery');

  await fillDelivery(page);
  await page.getByRole('button', { name: 'Place order' }).click();

  await expect(page.getByRole('heading', { name: 'Order confirmed' })).toBeVisible();
  await expect(page.getByText('Order SK-1042 · KSh 1,350 with delivery')).toBeVisible();

  expect(orders).toHaveLength(1);
  expect(orders[0]).toMatchObject({ items: { rooibos: 1, shea: 1 }, total: 1350 });
});

test('will not place an order with an empty basket', async ({ page }) => {
  const orders = await mockApi(page);
  await signIn(page);

  await fillDelivery(page);
  await page.getByRole('button', { name: 'Place order' }).click();

  await expect(page.getByRole('alert')).toHaveText('Add something to your basket first.');
  await expect(page.getByRole('heading', { name: 'Order confirmed' })).toBeHidden();
  expect(orders).toHaveLength(0);
});
JS
npx playwright test tests/checkout.spec.js

Notice the two kinds of expect. await expect(locator)... is web-first and retries. expect(orders)... checks a plain value once, with no await, as in any test runner. Only check plain values after a web-first assertion has proved the page got there, as these tests do with the Order confirmed heading.

The empty-basket test is as important as the happy path. Journeys break most often at the edges: an empty basket, a declined payment, a lost connection.

Check it worked

The run ends with 4 passed. Open main.js, change DELIVERY_FEE to 300, and run the same command again: the first test fails on the status line with an expected KSh 1,350 and a received KSh 1,400. Set the fee back to 250 and the test passes again.

Step 6 · Run the whole suite headless in both browsers

List what will run before running it. This is a quick way to confirm that new files are picked up and that both projects are active:

Bash
cd ~/playwright-e2e-demo
npx playwright test --list

Then run everything. The test:e2e script you added to package.json is the same command, and is the one to give teammates and CI:

Bash
cd ~/playwright-e2e-demo
npm run test:e2e

To run one browser only, add --project=firefox. To run one test, add part of its title with -g "empty basket". To watch a run while you write a new test, add --headed, or use npx playwright test --ui, which opens a window where you can step through each test. The HTML report from the last run opens with npx playwright show-report.

Bash
npx playwright show-report

Check it worked

--list ends with Total: 12 tests in 3 files, and every test appears twice, once marked [chromium] and once [firefox]. npm run test:e2e ends with 12 passed. A playwright-report folder now holds index.html, the report that show-report serves.

Step 7 · Debug a failing test with a trace

When a test fails on your machine you can rerun it with --headed and watch. When it fails in CI you cannot, so you need a recording. A Playwright trace is a zip file holding every action, a DOM snapshot before and after each one, console messages and network requests.

Suppose a teammate adds a test for a single coffee order and forgets that delivery is charged:

Bash
cd ~/playwright-e2e-demo
cat > tests/basket.spec.js <<'JS'
import { test, expect } from '@playwright/test';
import { mockApi, signIn } from './helpers.js';

test('one bag of coffee costs KSh 1,200', async ({ page }) => {
  await mockApi(page);
  await signIn(page);
  await page.getByRole('listitem').filter({ hasText: 'Coffee beans' }).getByRole('button', { name: 'Add to basket' }).click();
  await expect(page.getByRole('status')).toHaveText('1 item · KSh 1,200 with delivery');
});
JS

The config records traces only on the first retry, and retries only happen in CI. To record one now, run the new test with --trace on, which overrides the config for this run:

Bash
npx playwright test tests/basket.spec.js --project=chromium --trace on

The test fails after about five seconds, the expect timeout, with output something like this:

Text
Error: expect(locator).toHaveText(expected) failed

Locator:  getByRole('status')
Expected: "1 item · KSh 1,200 with delivery"
Received: "1 item · KSh 1,450 with delivery"

Below the error, Playwright prints the path of the trace inside test-results and the command that opens it. find test-results -name trace.zip lists the same file; it stays there only until the next run clears the folder. Run that command, with the path from your own output:

Bash
npx playwright show-trace test-results/<folder-from-your-output>/trace.zip

The Trace Viewer opens with a timeline across the top and the list of actions down the side. Click the toHaveText step: the snapshot shows the basket line as it was, the Network tab shows the POST /api/session answered by your mock, and the Source tab points at the failing line. Here the app is right and the test is wrong, so fix the test:

Bash
cd ~/playwright-e2e-demo
cat > tests/basket.spec.js <<'JS'
import { test, expect } from '@playwright/test';
import { mockApi, signIn } from './helpers.js';

test('one bag of coffee costs KSh 1,450 with delivery', async ({ page }) => {
  await mockApi(page);
  await signIn(page);
  await page.getByRole('listitem').filter({ hasText: 'Coffee beans' }).getByRole('button', { name: 'Add to basket' }).click();
  await expect(page.getByRole('status')).toHaveText('1 item · KSh 1,450 with delivery');
});
JS
npx playwright test tests/basket.spec.js

A trace contains whatever the page showed and sent, including anything typed into forms. Treat traces from tests that use real accounts as private, and do not attach them to public issues.

Check it worked

The Trace Viewer showed the failing toHaveText step with the KSh 1,450 basket line in its snapshot. After the fix, the last command ends with 2 passed, one per browser. That run cleared test-results, so the trace from the failure is gone now; find test-results -name trace.zip prints nothing.

Step 8 · Run the suite the way CI will

CI systems set the CI environment variable. Your config reads it: with CI set, Playwright always starts a fresh server, uses one worker, retries a failed test up to twice and records a trace on the first retry, and refuses to run if someone left a test.only in the code. Run the suite that way before you push:

Bash
cd ~/playwright-e2e-demo
CI=1 npm run test:e2e

In GitHub Actions the job installs dependencies with npm ci, installs the same two browsers, runs the suite and keeps the report even when tests fail. Run Node.js tests in GitHub Actions covers the workflow file around it; the steps for this suite are:

YAML
      - uses: actions/checkout@v7
      - uses: actions/setup-node@v7
        with:
          node-version: 26
          cache: npm
      - run: npm ci
      - run: npx playwright install --with-deps chromium firefox
      - run: npm run test:e2e
      - uses: actions/upload-artifact@v7
        if: ${{ !cancelled() }}
        with:
          name: playwright-report
          path: |
            playwright-report/
            test-results/
          retention-days: 14

When a CI run fails, download the playwright-report artifact, open the trace for the retried test with npx playwright show-trace, and debug it as in the previous step.

Check it worked

The run ends with 14 passed: seven tests in two browsers, run one after another, so it takes longer than the local run. Add .only to one test (test.only('signs in ...') and run CI=1 npm run test:e2e again: Playwright stops with an error about test.only and runs nothing. Remove the .only.

Step 9 · Clean up

Remove the demo folder. The browsers stay in the shared cache for your other projects; to remove them as well, run npx playwright uninstall --all from any project that has Playwright installed before you delete it.

Bash
cd ~
rm -rf ~/playwright-e2e-demo

Check it worked

ls ~/playwright-e2e-demo reports that there is no such file or directory.

Next steps

Need this done for you?

Padding does this work for growing companies, from the first diagnosis to a system that keeps working.

Digital Transformation

Get new tutorials

New tutorials, about twice a month.