Security News
Input Validation Vulnerabilities Dominate MITRE's 2024 CWE Top 25 List
MITRE's 2024 CWE Top 25 highlights critical software vulnerabilities like XSS, SQL Injection, and CSRF, reflecting shifts due to a refined ranking methodology.
@percy/cli
Advanced tools
[![Test](https://github.com/percy/cli/workflows/Test/badge.svg)](https://github.com/percy/cli/actions)
@percy/cli is a command-line interface for Percy, a visual testing and review platform. It allows you to automate visual testing for your web applications by capturing screenshots and comparing them against baselines to detect visual changes.
Snapshot
This feature allows you to capture snapshots of your web application at different screen widths. The code sample demonstrates how to capture snapshots of a local web application running on port 3000 at three different screen widths.
const percySnapshot = require('@percy/cli');
(async () => {
await percySnapshot('http://localhost:3000', { widths: [375, 768, 1280] });
})();
Start and Stop Percy
This feature allows you to start and stop the Percy agent programmatically. The code sample demonstrates how to start the Percy agent, run your tests, and then stop the agent.
const { start, stop } = require('@percy/cli');
(async () => {
await start();
// Run your tests here
await stop();
})();
Upload Snapshots
This feature allows you to upload pre-captured snapshots to Percy for comparison. The code sample demonstrates how to upload snapshots from a local directory.
const { upload } = require('@percy/cli');
(async () => {
await upload({ snapshots: ['./snapshots'] });
})();
Cypress is a JavaScript end-to-end testing framework that also supports visual testing through plugins like cypress-image-snapshot. It provides a comprehensive testing solution but requires additional setup for visual testing compared to @percy/cli.
Puppeteer is a Node library that provides a high-level API to control Chrome or Chromium over the DevTools Protocol. While it is primarily used for browser automation, it can also be used for visual testing by capturing screenshots and comparing them manually or with additional tools.
WebdriverIO is a test automation framework that allows you to run tests based on the WebDriver protocol and Appium. It supports visual regression testing through plugins like wdio-visual-regression-service, but requires more configuration compared to @percy/cli.
The Percy CLI is used to interact with, and upload snapshots to, percy.io via the command line.
$ npm install --save-dev @percy/cli
percy exec
- capture and upload snapshotspercy snapshot
- snapshot a static directory or a list of pagespercy upload
- upload a static directory of imagespercy config
- manage configuration filespercy build
- interact with Percy buildsIn addition to the CLI packages, this repo contains core libraries responsible for Percy's CI/CD integrations, Percy API communication, DOM serialization, asset discovery, etc.
@percy/core
- performs snapshot asset discovery and uploading@percy/client
- handles communicating with the Percy API@percy/dom
- serializes DOM snapshots@percy/env
- captures CI build environment variables@percy/config
- loads Percy configuration files@percy/logger
- common logger used throughout the CLI@percy/sdk-utils
- shared helpers for JavaScript SDKs@percy/cli-command
- Percy CLI command frameworkFor problems directly related to the CLI, add an issue on GitHub.
For other issues, open a support request.
This project is built with lerna. The core libaries and CLI plugins are
located in ./packages. Run yarn
to install dependencies after cloning the repo and
use the following scripts for various development tasks:
yarn build
- build all packagesyarn build:watch
- build and watch all packages in parallelyarn clean
- clean up build and coverage outputyarn lint
- lint all packagesyarn readme
- generate cli commands readme usageyarn test
- run all tests, one package after anotheryarn test:coverage
- run all tests with coverage, one package after anotheryarn global:link
- links all packages being developed as global.
yarn build
to be run before consuming.yarn link @percy/[core|cli..]
yarn global:unlink
- unlinks all packages globallyIndividual package scripts can be invoked using yarn's workspace command. For example:
$ yarn workspace @percy/core test
check in Core Package's readme here.
FAQs
[![Test](https://github.com/percy/cli/workflows/Test/badge.svg)](https://github.com/percy/cli/actions)
The npm package @percy/cli receives a total of 259,463 weekly downloads. As such, @percy/cli popularity was classified as popular.
We found that @percy/cli 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
MITRE's 2024 CWE Top 25 highlights critical software vulnerabilities like XSS, SQL Injection, and CSRF, reflecting shifts due to a refined ranking methodology.
Security News
In this segment of the Risky Business podcast, Feross Aboukhadijeh and Patrick Gray discuss the challenges of tracking malware discovered in open source softare.
Research
Security News
A threat actor's playbook for exploiting the npm ecosystem was exposed on the dark web, detailing how to build a blockchain-powered botnet.