Skip to content

browser-cli v0.2.1 live viewport command

Latest

Choose a tag to compare

@postmunnet postmunnet released this 18 May 16:36
· 3 commits to main since this release

Summary

Adds real-time viewport control for responsive verification.

Added

  • viewport [WIDTHxHEIGHT] command
  • set-viewport <WIDTHxHEIGHT> alias
  • Runtime presets: mobile, phone, tablet, desktop, wide
  • --viewport <WIDTHxHEIGHT> initial viewport flag
  • viewport.width / viewport.height config support
  • VIEWPORT_W / VIEWPORT_H env fallback
  • Unit tests for viewport parsing and command behavior

Example

printf "goto /
viewport 375x667
screenshot mobile.png
viewport 1440x900
screenshot desktop.png
exit
" \
  | node index.js --config configs/example.json --response-schema=v2

Verification

npm test

Result:

34 harness tests passed
8 viewport tests passed
10 recorder tests passed
12 CDP URL validation tests passed