Skip to content

Playwright Setup

Pre-requisites

Installation

Folder structure

.
├── tests/ // This folder contains your actual test scripts
│ └── example.spec.ts // Example test script
├── .gitignore // This file helps avoid committing unnecessary files
├── playwright.config.ts // Global configuration file for Playwright
├── package.json // To help to track dependencies and scripts
└── package-lock.json

Running tests

You read more about running tests in Playwright documentation.

Terminal window
# Run all tests (in headless mode)
npx playwright test
# Run specific tests (in headless mode)
npx playwright test tests/example.spec.ts
# View the report
npx playwright show-report
# Run all tests (in UI mode, or headed/headful mode)
npx playwright test --ui
# Run all tests in a specific browser
npx playwright test --browser=firefox

Syncing with GitHub

Syncing (and signing in) with your GitHub is a really useful way to not have to remember your local setup - and not worry as much about setting up on a new system.

Read more about it Settings Sync.