|
12 | 12 |
|
13 | 13 | <p align="center">
|
14 | 14 | <img src="https://github.com/FRSOURCE/cypress-plugin-visual-regression-diff/blob/main/src/assets/logo.svg" alt="Cypress Plugin Visual Regression Diff logo" height="120px"/>
|
15 |
| - <br> |
16 | 15 | </p>
|
17 | 16 |
|
18 |
| -<h1 align="center">Cypress Plugin Visual Regresion Diff</h1> |
| 17 | +<h1 align="center">Plugin for Cypress - Visual Regression Diff</h1> |
19 | 18 | <p align="center">Perform visual regression test with a nice GUI as help. 💅 <i>Only for Cypress!</i></p>
|
20 | 19 |
|
21 | 20 | <p align="center">
|
22 | 21 | <a href="#getting-started">Getting Started</a>
|
23 | 22 | ·
|
24 |
| - <a href="#documentation">Documentation</a> |
| 23 | + <a href="#usage">Usage</a> |
25 | 24 | ·
|
26 | 25 | <a href="https://github.com/FRSOURCE/cypress-plugin-visual-regression-diff/issues">File an Issue</a>
|
27 | 26 | ·
|
|
44 | 43 |
|
45 | 44 | ## Getting started
|
46 | 45 |
|
| 46 | +### Installation |
| 47 | + |
| 48 | +You can install this library using your favorite package manager: |
| 49 | + |
| 50 | +```bash |
| 51 | +# yarn |
| 52 | +yarn add -D @frsource/cypress-plugin-visual-regression-diff |
| 53 | + |
| 54 | +# npm |
| 55 | +npm install --save-dev @frsource/cypress-plugin-visual-regression-diff |
| 56 | +``` |
| 57 | + |
| 58 | +Next, you need to import the library: |
| 59 | + |
| 60 | +- once, in your support file (located by default in `cypress/support/index.js`): |
| 61 | +```ts |
| 62 | +// typescript |
| 63 | +import '@frsource/cypress-plugin-visual-regression-diff/src/support'; |
| 64 | + |
| 65 | +// javascript |
| 66 | +require('@frsource/cypress-plugin-visual-regression-diff/dist/support'); |
| 67 | +``` |
| 68 | + |
| 69 | +- seconds time, in your plugins file (located by default in `cypress/plugins/index.js`): |
| 70 | +```ts |
| 71 | +// typescript |
| 72 | +import '@frsource/cypress-plugin-visual-regression-diff/src/plugins'; |
| 73 | + |
| 74 | +// javascript |
| 75 | +require('@frsource/cypress-plugin-visual-regression-diff/dist/plugins'); |
| 76 | +``` |
| 77 | + |
| 78 | +That's it - now let's see how to use the library in [usage section](#usage). |
| 79 | + |
| 80 | +## Usage |
| 81 | + |
| 82 | +Once installed, the library might be used by writing in your test: |
| 83 | + |
| 84 | +```ts |
| 85 | +cy.get('.an-element-of-your-choice').matchImage(); |
| 86 | +``` |
| 87 | + |
| 88 | +Or, if you would like to make a screenshot of whole document: |
| 89 | + |
| 90 | +```ts |
| 91 | +cy.matchImage(); |
| 92 | +``` |
| 93 | + |
| 94 | +`matchImage` command will do a screenshot and compare it with image from a previous run. In case of regression the test will fail and you'll get a "Compare images" button to see what's a root of a problem. |
| 95 | + |
| 96 | +## Configuration |
| 97 | + |
| 98 | +This plugin can be configured either: |
47 | 99 |
|
48 |
| -## Documentation |
| 100 | +- via global env configuration, |
49 | 101 |
|
| 102 | +- directly, on a matcher level - by passing in plugin options as an argument to `matchImage` command, |
50 | 103 |
|
51 | 104 | ## Questions
|
52 | 105 |
|
|
0 commit comments