@playwright/test is Playwright's official test runner. A single init command scaffolds the config, installs the three browser engines, and creates example tests and a GitHub Actions workflow, giving you a runnable cross-browser suite out of the box.
Unlike Selenium, where you assemble a runner (JUnit/TestNG/pytest/Mocha), an assertion library and a reporter yourself, Playwright ships them together. npm init playwright@latest generates playwright.config.ts, a tests/ folder, and optionally a CI workflow. The config defines projects (browser/device combinations), timeouts, retries, the base URL and reporters. Tests are written with the test() and expect() functions imported from @playwright/test, and run headless by default. You run everything with npx playwright test, target one browser with --project=firefox, open the interactive UI mode with --ui, and view the last run's report with npx playwright show-report.
A new SDET joins and needs the suite running locally. They run npm ci, then npx playwright install, then npx playwright test --ui. Within minutes they're stepping through tests visually across Chromium, Firefox and WebKit — no manual driver downloads, no PATH configuration, no browser-version matching.
// playwright.config.ts
import { defineConfig, devices } from '@playwright/test';
export default defineConfig({
testDir: './tests',
timeout: 30_000,
retries: process.env.CI ? 2 : 0,
reporter: [['html'], ['list']],
use: {
baseURL: 'https://www.qapractice.com',
trace: 'on-first-retry',
screenshot: 'only-on-failure',
},
projects: [
{ name: 'chromium', use: { ...devices['Desktop Chrome'] } },
{ name: 'firefox', use: { ...devices['Desktop Firefox'] } },
{ name: 'webkit', use: { ...devices['Desktop Safari'] } },
],
});Scenario: A colleague copies Selenium habits and adds Mocha, Chai and a custom reporter to a fresh Playwright project 'to be consistent'. Is that a good idea? What would you recommend?
Commit playwright.config and the CI workflow early — reviewers judge a suite by its config (retries, trace, projects) as much as its tests.