PHPackages                             tr33m4n/codeception-module-percy - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [Testing &amp; Quality](/categories/testing)
4. /
5. tr33m4n/codeception-module-percy

ActiveLibrary[Testing &amp; Quality](/categories/testing)

tr33m4n/codeception-module-percy
================================

Percy https://percy.io module for Codeception

v6.0.1(7mo ago)4129.0k1MITPHPPHP ^8.1CI passing

Since Feb 9Pushed 5mo ago1 watchersCompare

[ Source](https://github.com/tr33m4n/codeception-module-percy)[ Packagist](https://packagist.org/packages/tr33m4n/codeception-module-percy)[ RSS](/packages/tr33m4n-codeception-module-percy/feed)WikiDiscussions master Synced 1mo ago

READMEChangelog (10)Dependencies (16)Versions (49)Used By (0)

[![Test](https://github.com/tr33m4n/codeception-module-percy/actions/workflows/test.yml/badge.svg)](https://github.com/tr33m4n/codeception-module-percy/actions/workflows/test.yml)

codeception-module-percy
========================

[](#codeception-module-percy)

Percy  module for Codeception

Requirements
------------

[](#requirements)

- Node.js `>=14.0.0`
- PHP `>= 8.1`
- Composer `v2`

Installation
------------

[](#installation)

```
composer require --dev tr33m4n/codeception-module-percy
```

Example Configuration
---------------------

[](#example-configuration)

The following example `acceptance.suite.yml` configuration assumes the `WebDriver` module has been configured correctly for your test suite and shows enabling the Percy module and setting some basic configuration:

```
modules:
    enabled:
        - WebDriver
        - Percy
    config:
      Percy:
        snapshotConfig:
          widths:
            - 1024
            - 768
            - 320
          minHeight: 1080
```

The following example shows how to configure the `percy:process-snapshots` in the `codeception.yml` file:

```
extensions:
    commands:
        - Codeception\Module\Percy\Command\ProcessSnapshots
```

### Configuration Options

[](#configuration-options)

ParameterTypeDefaultDescription`snapshotConfig`object`{}`Additional configuration to pass to the "snapshot" functionality`snapshotConfig.percyCSS`string`null`Percy specific CSS to apply to the "snapshot"`snapshotConfig.minHeight`int`null`Minimum height of the resulting "snapshot" in pixels`snapshotConfig.enableJavaScript`bool`false`Enable JavaScript in the Percy rendering environment`snapshotConfig.widths`array`null`An array of integers representing the browser widths at which you want to take snapshots`serializeConfig`object`{"enableJavaScript": true}`Additional configuration to pass to the `PercyDOM.serialize` method injected into the web driver DOM`collectOnly`bool`false`Setting this to `true` will only collect snapshots, rather than collect and then send at the end of the run. They can then be sent manually by calling the `vendor/bin/codecept percy:process-snapshots` command`snapshotServerTimeout`int`30`\[debug\] The length of the time the Percy snapshot server will listen for incoming snapshots and send on to Percy.io (the amount of time needed to send all snapshots after a successful test suite run). No timeout is set by default`snapshotServerPort`int`5338`\[debug\] The port the Percy snapshot server will listen on`snapshotServerDebug`bool`false`\[debug\] Output verbosely when running the underlying Node Percy library`snapshotFolder`string`null`\[debug\] Specify a snapshot folder to use when loading or sending snapshots. Folder respects basic glob patterns. Useful if moving snapshots around on the server before sending them with the CLI command`throwOnError`bool`false`\[debug\] Throw exception on adapter error`instanceId`string`null`\[debug\] An ID is used to differentiate between one Codeception runs output files to another, ensuring only the current runs output files are cleared on failure. Use this config to pass a custom instance IDRunning
-------

[](#running)

The Percy integration runs automatically with the test suite but will need your `PERCY_TOKEN` to be set to successfully send snapshots. For more information, see

### Overriding the `node` path

[](#overriding-the-node-path)

By default, the `node` executable used will be the one defined within the `PATH` of the user running the test suite. This can be overridden however, by setting the environment variable `PERCY_NODE_PATH` to your preferred location.

### Collect only

[](#collect-only)

In some advanced CI setups, it might make sense to collect all snapshots for multiple runs with different parameters and then send them a single time when all runs are complete. This can be achieved by setting the `collectOnly` config to `true`. Once all runs are complete, running the command `vendor/bin/codecept percy:process-snapshots`will then iterate all collected snapshots, send to Percy and then clean up the snapshot folder. The `percy:process-snapshots` command needs to be configured in the `codeception.yml` file, see the "Example Configuration" section

### Example Test

[](#example-test)

```
