Setting Up Your Environment
Last updated
Last updated
Download and install Node.js from
Verify installation:bash
Create a new directory for your project:bash
Initialize a new Node.js project:bash
Playwright provides an installer that sets up everything you need
During the setup, select the following options:
Choose TypeScript when prompted
Select browsers you want to test on (Chromium, Firefox, WebKit)
Add GitHub Actions workflow if you plan to use CI
The Playwright installer creates a basic tsconfig.json
file. Here's an explanation of key settings:
Understanding project structure
After installation, your project should have the following structure:
Key files:
playwright.config.ts: Configuration for your tests, including browsers, timeouts, and reporter settings.
tests/example.spec.ts: Example test file created by the installer.
package.json: Contains scripts to run your tests and project dependencies.
The installer creates an example test. Run it with:
To see a report of your test run:
To run tests with UI mode (for debugging):