This repository demonstrates how to use Playwright with TypeScript for end-to-end testing.
-
Install dependencies
npm install
-
Run Playwright install (to download browsers)
npx playwright install
-
Run tests
npx playwright test
tests/- Contains your test files (TypeScript)playwright.config.ts- Playwright configuration filepackage.json- Project metadata and scripts
Create your test files in the tests/ directory using TypeScript. Example:
import { test, expect } from '@playwright/test';
test('homepage has title', async ({ page }) => {
await page.goto('https://playwright.dev/');
await expect(page).toHaveTitle(/Playwright/);
});- Run all tests:
npx playwright test
- Run tests in headed mode:
npx playwright test --headed
- Generate test report:
npx playwright show-report
MIT