Skip to content
On this page
[Integrations]

Playwright

Tests run in a real Chromium driven by Playwright, so the engine under your end-to-end tests is the one you already know. You can paste a Playwright script into the editor and watch it replayed in the live browser, and the recorder writes Playwright out. What you cannot do is send us a repository of spec files to execute, and the reason is worth a paragraph.

Pasting a script

Put the script in the editor and run it. Your source is read, matched against a known vocabulary and turned into steps the browser performs. Anything outside that vocabulary is listed back with the line it came from, so you are never told a script passed when half of it was skipped.

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

test('sign in', async ({ page }) => {
  await page.goto('https://your-site.example/login');
  await page.getByLabel('Email').fill('qa@your-site.example');
  await page.getByLabel('Password').fill(process.env.TEST_PASSWORD || '');
  await page.getByRole('button', { name: 'Sign in' }).click();
  await expect(page.locator('.welcome')).toContainText('Hello');
});

Locators it understands

page.locator('css')

Used as written.

getByTestId('save')

Becomes [data-testid="save"].

getByPlaceholder('Email')

Matched on the placeholder, ignoring case.

getByLabel('Email')

Best effort: aria-label, placeholder or name. A label element cannot be resolved without the live page.

getByText('Sign in')

Matched on the text.

getByRole('button', { name })

Matched on the name; a role with no name becomes the tag it implies.

Actions and checks it performs

goto

A literal http or https address. The first one opens the run; a later one is reported.

click, dblclick

Clicked.

fill, type, pressSequentially

Typed into the field, the way a person types.

press

A key, from the same table the executor uses.

hover, focus, scrollIntoViewIfNeeded

Scrolled to and hovered.

expect(page)

toHaveURL and toHaveTitle, with a string or a regular expression, and .not.

expect(page.locator(…))

toBeVisible, toBeHidden, toContainText and toHaveText, with .not, .first() and .last().

Not performed, and named in the report rather than skipped quietly: check, uncheck, selectOption and setInputFiles. Loops, conditionals, helper functions, fixtures and page object methods are not read either. The caps are 100KB of source, 60 actions and 30 checks.

Why nothing is executed

Running submitted code on our servers would be remote code execution for anyone who can get text into a test, including a page title or a model's repair. There is no eval, no generated function and no child process on this path, and there will not be one. A script is recognised and replayed, or it is reported.

Going the other way

The recorder turns a flow you click through into a Playwright file. A recorded password comes out as an environment variable rather than a literal, so the file is safe to commit, and the recording asserts nothing until you add checks.

[Academy courses]