What is @percy/cli-command?
@percy/cli-command is a command-line interface (CLI) tool for managing Percy, a visual testing and review platform. It provides commands to interact with Percy services, such as starting and stopping Percy agents, uploading snapshots, and managing projects.
What are @percy/cli-command's main functionalities?
Start Percy Agent
This command starts the Percy agent, which is necessary for capturing visual snapshots during your tests.
npx @percy/cli-command start
Stop Percy Agent
This command stops the Percy agent, which is useful for cleaning up after your tests have completed.
npx @percy/cli-command stop
Upload Snapshots
This command uploads visual snapshots to Percy for comparison and review.
npx @percy/cli-command upload ./path/to/snapshots
Manage Projects
This command creates a new project in Percy, allowing you to organize and manage your visual tests.
npx @percy/cli-command project:create --name 'My Project'
Other packages similar to @percy/cli-command
cypress
Cypress is a JavaScript end-to-end testing framework that provides a rich set of features for writing and running tests. It includes built-in support for visual testing through plugins like cypress-image-snapshot, which can be used to capture and compare screenshots.
webdriverio
WebdriverIO is a popular testing framework for Node.js that allows you to run tests using the WebDriver protocol. It supports visual regression testing through plugins like wdio-visual-regression-service, which can capture and compare screenshots.
backstopjs
BackstopJS is a tool for visual regression testing that uses headless browsers to capture screenshots of web pages and compare them against baseline images. It provides a CLI for managing tests and generating reports.
@percy/cli-command
The base command class that Percy CLI commands should extend from. Adds commonly used configuration
options to Percy config files, a #percyrc()
method for parsing config files, and other shared
methods. Also provides common CLI flags along with oclif flag functions.
Usage
import PercyCommand, { flags } from '@percy/cli-command'
export class PercyPlugin extends PercyCommand {
static flags = {
...flags.logging,
...flags.discovery,
...flags.config
}
run() {
let { args, flags } = this
let { snapshot, discovery } = this.percyrc()
}
finally() {
}
}
Mapping CLI Flags
The #percyrc()
method will parse command flags for Percy configuration mappings as determined by a
percyrc
flag configuration option.
'allowed-hostnames': flags.string({
percyrc: 'discovery.allowedHostnames'
})