IKivan-kozenko -aqa
Try yourself as a QA tester
All topics·Beginner·1 / 16

Introduction to Playwright

What Playwright is, why it’s used for end-to-end testing, and how the test runner ships out of the box.

What is Playwright

One API — three browser engines, any OS, any mode

Playwright is an open-source end-to-end testing framework built and maintained by Microsoft. A single API drives Chromium (Chrome, Edge), Firefox and WebKit (Safari) across Windows, macOS, Linux, headless or headed, desktop or mobile emulation.

It ships with @playwright/test — its own test runner with parallelism, fixtures, web-first assertions and rich tooling (Trace Viewer, codegen, UI mode). You do not need Jest, Mocha or a separate runner to start.

Install in a new project

The recommended way to bootstrap is the official init command. It scaffolds playwright.config.ts, an example test, GitHub Actions workflow and installs browser binaries.

bash
npm init playwright@latest
# or
pnpm create playwright
ts
import { test, expect } from '@playwright/test'

test('has title', async ({ page }) => {
  await page.goto('https://playwright.dev/')
  await expect(page).toHaveTitle(/Playwright/)
})

Run your tests

Tests are launched with npx playwright test. By default Playwright runs every project from the config in parallel; pass --headed to see the browser, --debug to step through, --ui to open the watch-mode UI runner.

bash
npx playwright test
npx playwright test --headed
npx playwright test --ui
npx playwright show-report