# Playwright checks

> Monitor full user journeys with Playwright: write a script, run it in real Chromium on a schedule from several regions, and debug with screenshots and traces.

A browser check runs a Playwright script in a real Chromium browser on a schedule. Use it for journeys that a single HTTP request cannot prove: log in, sign up, search, check out.

## Write a script

Browser checks use the Playwright test API. Each check is one test file.

```ts
import { test, expect } from '@playwright/test';

test('customer can log in', async ({ page }) => {
  await page.goto('https://app.example.com/login');
  await page.getByLabel('Email').fill(process.env.TEST_USER_EMAIL!);
  await page.getByLabel('Password').fill(process.env.TEST_USER_PASSWORD!);
  await page.getByRole('button', { name: 'Log in' }).click();
  await expect(page.getByRole('heading', { name: 'Dashboard' })).toBeVisible();
});
```

Use **Run now** in the editor to try the script before you save it.

## Secrets

Store test accounts and keys as encrypted **variables** on the check. They are available as `process.env.NAME` in the script and are never shown in results or logs. Use a dedicated test account with the least rights it needs.

## Schedule and locations

- Schedules from every 5 minutes to once a day.
- Run from one or more public regions, or from a private agent to test internal apps.
- The same false-alarm controls apply as for every monitor: confirmation from more than one region, failures in a row and maintenance windows.

## Results

Every run records:

| Result | What you get |
| --- | --- |
| Status | Passed or failed, with the failing step and the error |
| Step timings | Duration of each test step |
| Screenshot | The page at the moment of failure |
| Trace | A Playwright trace to replay actions, network requests and console messages |
| Web Vitals | LCP, CLS and total blocking time |

## Limits

- One test file per check, with a run time of up to 2 minutes.
- Each run starts in a fresh, isolated browser; nothing is kept between runs.
- Files on your computer cannot be imported; keep helpers inside the test file.
