ppts
performance-puppeteer-tests, based on node and puppeteer, try to measures the indicators of the web performance, including the jsHeapUsedSize, jsHeapTotalSize, firstPaint, firstMeaningfulPaint, domContentLoaded and loadEventEnd.
What's more, ppts can be used to calculate the average and standardDeviation of indicators of the web performance when you repeat a specific number of time. And ppts is also support to choose the specific phone devices to emulate.
See the Usage for more details.
LatestVersion: v1.4.0
What is new:
v1.4.0: Support webhook function when the outputFormat is json.
v1.3.0: Change the methods of opening url.
v1.2.0: Support phone and cache model.
v1.1.1: Support the measurement of indicators of web performance.
Installation
To install ppts :
npm install -g ppts --registry=https://registry.npm.taobao.org
Measures indicators of the web performance
Measures: | min | median | max | average | standardDeviation | 最小值 中间值 最大值 平均值 方差 Indicators: jsHeapUsedSize 占用的堆的大小 jsHeapTotalSize 堆占用的总内存 firstPaint 白屏时间 firstMeaningfulPaint 首屏时间 domContentLoaded 可交互时间 loadEventEnd 加载完成时间
Usage
To run the application, just use :
ppts <url>
Several options are available to enhance metrics easily. Use -h (--help)
to display them.
➜ ppts -h Usage: cli <url> [options] Description: performance-puppeteer-tests Author: Shaonian <licetianyr@163.com> Options: -r, --repeat [n] 指定加载次数 (default: 5) -w, --width [width] 浏览器首屏的宽度 (default: "1920") -H, --height [height] 浏览器首屏的高度 (default: "1080") -o, --output-format [output-format] 输出报告格式 (default: "table") -c, --custom-path [custom-path] 载入配置文件(default: null) --phone [device-name] 是否启用手机模式(default: null) --cache 是否启用浏览器缓存 (default: false) --webhook [webhook-url] 是否启用webhook通知(default: null) --output-file [output-file] 输出报告文件(default: txt) --wait-until [wait-until] 加载完成的标志(default: load) --no-headless 浏览器无头模式(default: true) --no-sandbox 适配Linux无沙盒模式(default: false) -h, --help output usage information
Setting repeat times
ppts -r 100 https://www.baidu.com
Setting no-headless
ppts https://www.baidu.com --no-headless false
Setting no-sandbox (Run in Linux)
ppts https://www.baidu.com --no-sandbox true
Setting complex actions as extend customs (Such as: login.js)
ppts -c './extend_custom/login.js' https://mubu.com
Setting with cache
ppts https://www.baidu.com --cache true
Setting the webhook
ppts https://www.baidu.com --output-format json --webhook your-webhook-url
Setting with phone mode
ppts https://www.baidu.com --phone 'iPhone X' --no-headless false
Support devices
Blackberry PlayBookBlackberry PlayBook landscapeBlackBerry Z30BlackBerry Z30 landscapeGalaxy Note 3Galaxy Note 3 landscapeGalaxy Note IIGalaxy Note II landscapeGalaxy S IIIGalaxy S III landscapeGalaxy S5Galaxy S5 landscapeiPadiPad landscapeiPad MiniiPad Mini landscapeiPad ProiPad Pro landscapeiPhone 4iPhone 4 landscapeiPhone 5iPhone 5 landscapeiPhone 6iPhone 6 landscapeiPhone 6 PlusiPhone 6 Plus landscapeiPhone 7iPhone 7 landscapeiPhone 7 PlusiPhone 7 Plus landscapeiPhone 8iPhone 8 landscapeiPhone 8 PlusiPhone 8 Plus landscapeiPhone SEiPhone SE landscapeiPhone XiPhone X landscapeiPhone XRiPhone XR landscapeJioPhone 2JioPhone 2 landscapeKindle Fire HDXKindle Fire HDX landscapeLG Optimus L70LG Optimus L70 landscapeMicrosoft Lumia 550Microsoft Lumia 950Microsoft Lumia 950 landscapeNexus 10Nexus 10 landscapeNexus 4Nexus 4 landscapeNexus 5Nexus 5 landscapeNexus 5XNexus 5X landscapeNexus 6Nexus 6 landscapeNexus 6PNexus 6P landscapeNexus 7Nexus 7 landscapeNokia Lumia 520Nokia Lumia 520 landscapeNokia N9Nokia N9 landscapePixel 2Pixel 2 landscapePixel 2 XLPixel 2 XL landscape