🧪
Testing5M+/wkApache-2.0

@playwright/test

Playwright is a modern end-to-end testing and browser automation framework developed by Microsoft that supports Chromium, Firefox, and WebKit browsers with a si

Installation

npm
npm install -D @playwright/test
yarn
yarn add -D @playwright/test
pnpm
pnpm add -D @playwright/test

Import

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

Quick Example

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

test('homepage has title', async ({ page }) => {
  await page.goto('https://example.com');
  await expect(page).toHaveTitle(/Example/);
  await expect(page.locator('h1')).toBeVisible();
});

About @playwright/test

Playwright is a modern end-to-end testing and browser automation framework developed by Microsoft that supports Chromium, Firefox, and WebKit browsers with a single API. Playwright tests run across all major browser engines and platforms, enabling comprehensive cross-browser testing with reliable, flake-free execution. The framework provides auto-waiting that intelligently waits for elements to be actionable before performing operations, eliminating the need for manual waits and sleep statements that plague other testing tools. Playwright includes built-in support for testing on mobile viewports, emulating geolocation and permissions, intercepting network requests, capturing screenshots and videos, and generating trace files for debugging test failures. The test runner supports parallel execution, test fixtures for dependency injection, built-in assertions with auto-retry, and a rich HTML reporter. Playwright's codegen tool records user interactions in the browser and generates test scripts automatically. The framework handles iframes, shadow DOM, multiple tabs, file uploads and downloads, and web component testing natively. Playwright has rapidly overtaken older tools in adoption due to its reliability and developer experience.

Quick Facts

Package@playwright/test
CategoryTesting
Weekly Downloads5M+
LicenseApache-2.0
Installnpm install -D @playwright/test

Related Packages

Browse npm Packages by Category

Explore our reference of 200 popular npm packages with install commands, examples, and quick-start guides.