Skip to content

Latest commit

 

History

History
53 lines (37 loc) · 1.55 KB

README.md

File metadata and controls

53 lines (37 loc) · 1.55 KB

This is a basic Playwright in Typescript that was setup like this

brew install node pnpm
pnpm create playwright

Getting started

Playwright needs to fetch its own versions of instrumented browsers. Run the following on your machine

pnpm install
pnpm exec playwright install

It downloads Chromium, Firefox, Webkit, and also ffmpeg.

du -hs ${HOME}/Library/Caches/ms-playwright
881M    /Users/jdanek/Library/Caches/ms-playwrigh

Use either the VS Code Playwright extension or the IntelliJ one for nice UX.

Also try out the UI mode and the codegen mode.

pnpm playwright test --ui
pnpm playwright codegen localhost:8787

The main differentiators of Playwright are auto-waiting, the browser fetching seen above, and integration and access to browser APIs (geolocation, ...).

Playwright test runner uses fixtures injection, similarly to Pytest.

For debugging, run test with --headed and put await page.pause() somewhere the test. This only works when you "run" and not "run with debug" the test in the IDE.

The HTML report captures screenshot on failure, so maybe that's enough to figure out the failure.

CI captures execution traces that can be opened in the trace viewer and explored.

pnpm playwright show-trace path/to/trace.zip