Chapter 33: Project structure and configuration
Automation learning lab
Playwright Automation
Self Study Guide
Start from zero. Learn JavaScript and TypeScript, automate browsers, and build reliable end-to-end tests.
Project structure and configuration
The configuration file controls test discovery, timeout, projects and reporting. tests contains spec files; package.json tracks dependencies and scripts. The generated structure may differ by initializer choices and version.
How it works
Step-by-step walkthrough
- Open playwright.config.ts
- Set a test directory
- Run discovered tests
Example
import { defineConfig, devices } from '@playwright/test';
export default defineConfig({
testDir: './tests',
reporter: 'html',
projects: [{ name: 'chromium', use: { ...devices['Desktop Chrome'] } }]
});Keep machine-specific paths and credentials outside shared config.
✎ Your practice task
Add a Firefox project using Desktop Firefox.
Knowledge check
Which file configures test projects?
🌐 Continue learning
60-chapter learning path
Start at chapter 1, or choose any topic. Your progress is tracked separately for each chapter.
JavaScript fundamentals
TypeScript fundamentals
Playwright • setup & locators
Playwright • interactions & assertions
Playwright • framework & debugging
Playwright • real-world automation
Interactive practice lab
Try the controls below and observe the corresponding Playwright locator instructions. This browser demo does not execute Node.js or Playwright Test; copy the code to your local Playwright project to automate it.
Task manager demo
Suggested automation
Actions on the demo update these examples. In your local test use a page that contains the same controls.
Download a standalone lab page, then serve it locally (for example with Python's http.server). Navigate to it in a Playwright test.