Skip to content

Commit

Permalink
Add docs for parallel cypress runs
Browse files Browse the repository at this point in the history
I just released support for this.
  • Loading branch information
trotzig committed May 30, 2020
1 parent 5f43c5a commit b22ee79
Showing 1 changed file with 21 additions and 2 deletions.
23 changes: 21 additions & 2 deletions website/docs/cypress.md
Expand Up @@ -2,6 +2,7 @@
id: cypress
title: Cypress
---

The `happo-cypress` module adds [Happo.io](https://happo.io) cross-browser
screenshots to your [Cypress.io](https://cypress.io) test suite.

Expand Down Expand Up @@ -92,8 +93,8 @@ one Happo report.
To record Happo screenshots in your test suite, use `happoScreenshot`:

```js
describe('Home page', function() {
it('loads properly', function() {
describe('Home page', function () {
it('loads properly', function () {
cy.visit('/');
cy.get('.header').happoScreenshot();
});
Expand Down Expand Up @@ -168,6 +169,24 @@ variables before invoking the test suite:
different base branch.
- `HAPPO_CHANGE_URL` a url to the PR/commit. Optional.

### Parallel builds

If you're running your [Cypress test suite across multiple
machines](https://docs.cypress.io/guides/guides/parallelization.html), you'll
need to do two things:

- Set a `HAPPO_NONCE` environment variable, to tie individual runs together. Any
string unique to the build will do.
- After the whole test suite is done, call `npx happo-cypress finalize`. Make
sure that the same `HAPPO_NONCE` environment variable is set as for the
individual builds.

In some CI tools, you can use a built-in environment variable as `HAPPO_NONCE`.
In CircleCI for instance, you can use [
`HAPPO_NONCE=${CIRCLE_WORKFLOW_ID}`](https://circleci.com/docs/2.0/env-vars/#built-in-environment-variables).
You can also use a timestamp or a randomly generated string. The important thing
is that it's unique to the current CI run.

## Troubleshooting

### I need support!
Expand Down

0 comments on commit b22ee79

Please sign in to comment.