
Security News
Attackers Are Hunting High-Impact Node.js Maintainers in a Coordinated Social Engineering Campaign
Multiple high-impact npm maintainers confirm they have been targeted in the same social engineering campaign that compromised Axios.
page-regression-tester
Advanced tools
決定論的キャプチャによるWebページのビジュアルリグレッションテストツール / Visual regression testing tool for web pages with deterministic capture
Visual regression testing tool for web pages with deterministic capture.
English | 日本語
npm install
npm run build
npm link
Or install Playwright browsers:
npx playwright install chromium
Capture a screenshot of a web page with deterministic behaviors:
page-regression-tester capture <url> [options]
# Simple screenshot
page-regression-tester capture https://example.com --output ./tmp/baseline.png
# With structure snapshot
page-regression-tester capture https://example.com \
--output ./tmp/baseline.png \
--save-snapshot
# Advanced options
page-regression-tester capture https://example.com \
--output ./tmp/homepage.png \
--viewport 1920x1080 \
--dpr 2 \
--wait-selector '[data-testid="hero"]' \
--mask '[data-testid="carousel"]' \
--mock-time "2025-01-01T00:00:00Z" \
--block-urls "**/analytics/**,**/ads/**" \
--save-snapshot
| Option | Description | Default |
|---|---|---|
-o, --output <path> | Output file path | ./tmp/capture.png |
--viewport <size> | Viewport size (WIDTHxHEIGHT) | 1440x900 |
--dpr <number> | Device pixel ratio | 2 |
--wait-until <state> | Wait until state (load/domcontentloaded/networkidle) | networkidle |
--wait-selector <selectors> | Wait for selectors (comma-separated) | - |
--wait-timeout <ms> | Wait timeout in milliseconds | 30000 |
--mask <selectors> | Mask selectors (comma-separated) | - |
--disable-animations | Disable animations and transitions | true |
--mock-time <time> | Fix time to ISO 8601 timestamp | - |
--mock-seed <number> | Random seed for Math.random() | 42 |
--block-urls <patterns> | Block URL patterns (comma-separated) | - |
--inject-css <path> | Inject custom CSS file | - |
--inject-js <path> | Inject custom JavaScript file | - |
--browser <type> | Browser type (chromium/firefox/webkit) | chromium |
--no-headless | Run browser in headful mode | - |
--save-snapshot | Save structure snapshot JSON | false |
--snapshot-selectors <selectors> | Structure snapshot selectors (comma-separated) | header,nav,[data-testid] |
Compare two screenshots and generate diff images:
page-regression-tester compare <baseline> <current> [options]
# Simple comparison (pixel-based)
page-regression-tester compare tmp/baseline.png tmp/current.png
# With SSIM comparison
page-regression-tester compare tmp/baseline.png tmp/current.png \
--method pixel,ssim \
--output ./tmp/diff/
# SSIM-only comparison (structural similarity)
page-regression-tester compare tmp/baseline.png tmp/current.png \
--method ssim \
--output ./tmp/diff/
# Multiple diff styles
page-regression-tester compare tmp/baseline.png tmp/current.png \
--diff-style sidebyside \
--output ./tmp/diff/
| Option | Description | Default |
|---|---|---|
-o, --output <dir> | Output directory for diff images | ./tmp/diff/ |
--method <methods> | Comparison methods (comma-separated: pixel,ssim) | pixel |
--threshold <number> | Diff threshold (0.0-1.0, minimum 0.15 for tolerance) | 0.002 |
--diff-style <style> | Diff image style (heatmap/sidebyside/overlay/blend) | heatmap |
--ignore-regions <regions> | Ignore regions (X,Y,W,H separated by semicolon) | - |
--ignore-antialiasing | Ignore antialiasing differences | true |
--color-threshold <number> | Color diff threshold (0-255) | 10 |
--json | Output JSON result | true |
pixel - Pixel-by-pixel comparison using pixelmatch algorithm
ssim - Structural Similarity Index (SSIM)
All comparison methods (pixel, SSIM) apply a 15% tolerance by default:
This design accommodates unavoidable minor differences in deterministic captures (e.g., dynamic content, browser rendering variations) while still allowing stricter thresholds when needed.
Examples:
# Uses 15% tolerance (since 0.002 < 0.15)
page-regression-tester compare baseline.png current.png --threshold 0.002
# Uses 20% tolerance (since 0.20 > 0.15)
page-regression-tester compare baseline.png current.png --threshold 0.20
diff-heatmap.png - Heatmap showing differencesdiff-sidebyside.png - Side-by-side comparison (if requested)diff-overlay.png - Overlay comparison (if requested)diff-blend.png - Blended comparison (if requested)result.json - Detailed comparison resultsComing soon...
Run complete regression test workflows:
page-regression-tester workflow --config ./config.yaml
This tool implements various techniques to make web pages deterministic (reproducible):
prefers-reduced-motionDate.now() to a specific timestampMath.random() with a fixed valuePerformance.now()IntersectionObserver to trigger immediatelySee SPEC.md for detailed specification and CONCEPT.md for design philosophy.
page-regression-tester/
├── src/
│ ├── cli/ # CLI commands
│ │ ├── index.ts # Main CLI entry point
│ │ └── capture.ts # Capture command
│ ├── capture/ # Capture module
│ │ ├── index.ts # Capture execution
│ │ ├── deterministic.ts # Deterministic scripts
│ │ └── snapshot.ts # Structure snapshot
│ ├── compare/ # Compare module (coming soon)
│ ├── report/ # Report generation (coming soon)
│ ├── config/ # Configuration loader (coming soon)
│ ├── utils/ # Utilities
│ │ ├── logger.ts # Logging
│ │ ├── file.ts # File operations
│ │ └── validator.ts # Input validation
│ └── types.ts # TypeScript type definitions
├── bin/
│ └── cli.js # CLI executable
├── dist/ # Compiled JavaScript
├── package.json
├── tsconfig.json
├── SPEC.md # Full specification
├── CONCEPT.md # Design concepts
└── README.md # This file
# Install dependencies
npm install
# Install Playwright browsers
npx playwright install chromium
# Build
npm run build
# Link for local development
npm link
# Watch mode
npm run dev
# Lint
npm run lint
# Format
npm run format
# Test
npm test
# Run all tests
npm test
# Run tests with coverage
npm run test:coverage
# Run integration tests
npm run test:integration
The project has comprehensive test coverage:
Test Files:
__tests__/utils/ - Utility function tests__tests__/compare/ - Comparison algorithm tests__tests__/helpers/ - Test helper utilitiesNote: Capture modules and CLI commands require integration tests with Playwright and are excluded from unit test coverage metrics.
MIT
FAQs
決定論的キャプチャによるWebページのビジュアルリグレッションテストツール / Visual regression testing tool for web pages with deterministic capture
We found that page-regression-tester demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Security News
Multiple high-impact npm maintainers confirm they have been targeted in the same social engineering campaign that compromised Axios.

Security News
Axios compromise traced to social engineering, showing how attacks on maintainers can bypass controls and expose the broader software supply chain.

Security News
Node.js has paused its bug bounty program after funding ended, removing payouts for vulnerability reports but keeping its security process unchanged.