A pluggable Playwright setup. Point it at any web app or webpage with one env var — no code changes — then build tests fast with codegen + UI Mode.
Scope: covers web apps, webpages, and mobile web (iPhone/Android device emulation). Native iOS/Android apps are out of scope — those need Appium or Maestro.
npm install
npm run install:browsers # downloads Chromium, Firefox, WebKit- Record a flow against your target — this writes the test code for you:
BASE_URL=https://your-app.com npm run codegen -- https://your-app.com # or emulate an iPhone while recording: BASE_URL=https://your-app.com npm run codegen:iphone -- https://your-app.com - Paste the generated body into a
test(...)intests/. - Iterate in UI Mode — watch mode re-runs as you edit, with time-travel DOM snapshots:
In UI Mode: click the eye icon to watch a test, use Pick Locator to build/validate selectors.
BASE_URL=https://your-app.com npm run test:ui
# Deployed site
BASE_URL=https://staging.example.com npm run test:ui
# Local dev server (auto-started for you)
BASE_URL=http://localhost:3000 START_CMD="npm run dev" npm test| Command | What it does |
|---|---|
npm run test:ui |
Interactive UI Mode (build/debug here) |
npm run codegen |
Record clicks → generated test code |
npm test |
Headless run, all projects |
npm run test:headed |
Watch the browser run |
npm run report |
Open the last HTML report |
Defined in playwright.config.ts: chromium, firefox, webkit, iphone (iPhone 15), android (Pixel 7). Run one with --project:
BASE_URL=https://your-app.com npm test -- --project=iphone