postman-playwright
v1.1.1
Published
Playwright plugin that captures network traffic during UI tests for use with the Postman CLI.
Downloads
137
Maintainers
Readme
postman-playwright
The Postman Playwright integration. This plugin captures API traffic during your Playwright UI tests so the Postman CLI can analyse it — match observed calls to your Postman collections, run pm.test assertions against the responses, and surface contract drift, coverage gaps, and silent failures the UI alone can't catch.
This package is the capture half of the workflow. It is meant to be used alongside postman-cli.
Installation
npm install --save-dev postman-cli postman-playwright@playwright/test (>=1.40.0) is a peer dependency — bring your own version.
Usage
Wrap your Playwright config with withPostman.
// playwright.config.ts
import { defineConfig } from '@playwright/test';
import { withPostman } from 'postman-playwright';
export default withPostman(defineConfig({
testDir: './tests'
}));withPostman does exactly two things:
- Appends Playwright's built-in
jsonreporter writing totest-results/playwright-report.json— alongside the per-testtrace.zipfiles Playwright already produces under its defaultoutputDir. The Postman CLI reads both directly. If you already have ajsonreporter configured, youroutputFileis preserved. - Forces
use.traceto{ mode: 'on', snapshots: true}.mode: 'on'plussnapshots: trueare required — Playwright only writes the trace's network log when DOM snapshots are enabled.
Running
Run your tests through the Postman CLI to capture and analyse in one step:
postman application test -- npx playwright testThe CLI looks under test-results/ (Playwright's default outputDir) for the JSON report plus the per-test trace zips, and analyses the captured traffic against your Postman collections.
Resources
- Playwright Integration Guide — End-to-end workflow, coverage policies, noise filters, and capturing traffic into collections (link coming soon)
Support
- Postman Support — For general support and troubleshooting
- GitHub Issues — For bug reports and feature requests
