Skip to main content

Installation

Requirements​

Supported
@playwright/test1.30 or newer (peer dependency)
Node.js18 or newer
Module systemsCommonJS and ES modules
TypeScript moduleResolutionnode (node10), node16/nodenext and bundler
BrowsersChromium, Firefox and WebKit

See Compatibility for what each Playwright version supports and what CI verifies.

Install​

npm install --save-dev playwright-logger-pro

@playwright/test is a peer dependency: the package never installs its own copy, so it always instruments the Playwright that runs your tests.

Version

npm install playwright-logger-pro installs the latest version from npm. Browser logging (browserLog, browserLogger, attachBrowserLogger) needs 0.2.0 or later; 0.1.0 has API logging only. Pre-releases are published under the next tag.

Import​

The package has two entry points.

tests/example.spec.ts
// The drop-in `test` / `expect`: both loggers are active.
import { test, expect } from 'playwright-logger-pro/fixtures';

// Building blocks, for when you do not use the fixtures.
import { wrapRequestContext, attachBrowserLogger } from 'playwright-logger-pro';

Type your config​

apiLog and browserLog are Playwright option fixtures. Pass LoggerOptions to defineConfig so use is type-checked:

playwright.config.ts
import { defineConfig } from '@playwright/test';
import type { LoggerOptions } from 'playwright-logger-pro/fixtures';

export default defineConfig<LoggerOptions>({
use: {
baseURL: 'http://localhost:3000',
apiLog: { curl: 'on-failure' },
browserLog: { network: 'failed' },
},
});

ApiLoggerOptions (only apiLog) and BrowserLoggerOptions (only browserLog) are exported as well.

TypeScript settings​

Types resolve under every moduleResolution value. For node/node10, the package ships typesVersions so that playwright-logger-pro/fixtures resolves too. If your editor reports TS2307 on the /fixtures import, see Troubleshooting.

Monorepos and pnpm​

With pnpm's strict node_modules, playwright-logger-pro finds @playwright/test through its peer dependency, so install both in the package that owns your Playwright config:

npm install --save-dev @playwright/test playwright-logger-pro

Keep a single copy of @playwright/test per workspace: if the logger and your tests resolve different copies, the fixtures it extends are not the ones your tests run with.

Check the install​

npm ls playwright-logger-pro @playwright/test

Then run any spec that imports from playwright-logger-pro/fixtures and a request should print → and ← lines. If nothing is printed, see No logs at all.

Uninstall​

npm uninstall playwright-logger-pro

Then switch your imports back to @playwright/test and remove apiLog and browserLog from use.