Skip to content

Commit 006ea2b

Browse files
authored
Merge pull request #5 from braze-inc/merge-upstream
Merge upstream
2 parents 3ca0a62 + e72fe33 commit 006ea2b

33 files changed

+554
-338
lines changed

.eslintrc.js

+12-19
Original file line numberDiff line numberDiff line change
@@ -1,38 +1,31 @@
11
module.exports = {
22
root: true,
3-
plugins: [
4-
'@typescript-eslint',
5-
'eslint-comments',
6-
"cypress"
7-
],
3+
plugins: ["@typescript-eslint", "eslint-comments", "cypress"],
84
env: {
95
es6: true,
106
node: true,
11-
'cypress/globals': true
7+
"cypress/globals": true,
128
},
139
extends: [
14-
'eslint:recommended',
15-
'plugin:@typescript-eslint/recommended',
16-
'plugin:eslint-comments/recommended',
17-
'prettier'
10+
"eslint:recommended",
11+
"plugin:@typescript-eslint/recommended",
12+
"plugin:eslint-comments/recommended",
13+
"prettier",
1814
],
1915
overrides: [
2016
{
21-
files: ['**.ts'],
22-
parser: '@typescript-eslint/parser',
17+
files: ["**.ts"],
18+
parser: "@typescript-eslint/parser",
2319
parserOptions: {
24-
sourceType: 'module',
25-
project: [
26-
'./tsconfig.json',
27-
'./packages/*/tsconfig.json',
28-
],
20+
sourceType: "module",
21+
project: ["./tsconfig.json", "./example/tsconfig.json"],
2922
tsconfigRootDir: __dirname,
3023
warnOnUnsupportedTypeScriptVersion: false,
3124
EXPERIMENTAL_useSourceOfProjectReferenceRedirect: true,
3225
},
3326
rules: {
34-
'@typescript-eslint/explicit-module-boundary-types': 'off'
35-
}
27+
"@typescript-eslint/explicit-module-boundary-types": "off",
28+
},
3629
},
3730
],
3831
};

.github/FUNDING.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -2,4 +2,4 @@
22

33
github: [FRSOURCE]
44
patreon: frsource
5-
custom: ['https://www.buymeacoffee.com/FRSOURCE']
5+
custom: ["https://www.buymeacoffee.com/FRSOURCE"]

.github/ISSUE_TEMPLATE/bug_report.md

+7-6
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,17 @@
11
---
22
name: Bug report
33
about: Create a report to help us improve
4-
title: ''
4+
title: ""
55
labels: bug
6-
assignees: ''
7-
6+
assignees: ""
87
---
98

109
**Describe the bug**
1110
A clear and concise description of what the bug is.
1211

1312
**To Reproduce**
1413
Steps to reproduce the behavior:
14+
1515
1. Go to '...'
1616
2. Click on '....'
1717
3. Scroll down to '....'
@@ -24,9 +24,10 @@ A clear and concise description of what you expected to happen.
2424
If applicable, add screenshots to help explain your problem.
2525

2626
**Please complete the following information:**
27-
- OS and version: [e.g. Windows 10 build. 19043.1319]
28-
- Browser and version [e.g. chrome 22]
29-
- Cypress version [e.g. 8.6.0]
27+
28+
- OS and version: [e.g. Windows 10 build. 19043.1319]
29+
- Browser and version [e.g. chrome 22]
30+
- Cypress version [e.g. 8.6.0]
3031

3132
**Additional context**
3233
Add any other context about the problem here.

.github/ISSUE_TEMPLATE/feature_request.md

+2-3
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,9 @@
11
---
22
name: Feature request
33
about: Suggest an idea for this project
4-
title: ''
4+
title: ""
55
labels: enhancement
6-
assignees: ''
7-
6+
assignees: ""
87
---
98

109
**Is your feature request related to a problem? Please describe.**

.prettierignore

+7
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
node_modules
2+
dist
3+
coverage
4+
CHANGELOG.md
5+
.yarnrc.yml
6+
example/.yarnrc.yml
7+
.yarn

CHANGELOG.md

+17-45
Original file line numberDiff line numberDiff line change
@@ -1,58 +1,30 @@
1-
# 1.0.0 (2022-10-31)
1+
# [3.1.0](https://github.com/FRSOURCE/cypress-plugin-visual-regression-diff/compare/v3.0.4...v3.1.0) (2022-11-03)
2+
3+
4+
### Features
5+
6+
* support Cypress retries functionality ([#171](https://github.com/FRSOURCE/cypress-plugin-visual-regression-diff/issues/171)) ([7d7d010](https://github.com/FRSOURCE/cypress-plugin-visual-regression-diff/commit/7d7d010938ee124e694e8cf0270aa99c89db59df)), closes [#168](https://github.com/FRSOURCE/cypress-plugin-visual-regression-diff/issues/168)
7+
8+
## [3.0.4](https://github.com/FRSOURCE/cypress-plugin-visual-regression-diff/compare/v3.0.3...v3.0.4) (2022-11-03)
29

310

411
### Bug Fixes
512

6-
* btoa utf8 encoding/decoding error ([#114](https://github.com/braze-inc/cypress-plugin-visual-regression-diff/issues/114)) ([0137014](https://github.com/braze-inc/cypress-plugin-visual-regression-diff/commit/01370148094f3152a374f4e612e75ef5fd2bc3d8))
7-
* create missing dirs when renaming screenshot files ([38e5ff5](https://github.com/braze-inc/cypress-plugin-visual-regression-diff/commit/38e5ff5d5f7c2a8d9b971deb13af821773815f66))
8-
* **deps:** pin dependency vue to 3.2.37 ([#68](https://github.com/braze-inc/cypress-plugin-visual-regression-diff/issues/68)) ([d09a762](https://github.com/braze-inc/cypress-plugin-visual-regression-diff/commit/d09a762bbcf0f6e9bb886f80e4d01724bf0e3367))
9-
* **deps:** update dependency @frsource/base64 to v1.0.3 ([#144](https://github.com/braze-inc/cypress-plugin-visual-regression-diff/issues/144)) ([09ecbd8](https://github.com/braze-inc/cypress-plugin-visual-regression-diff/commit/09ecbd81c9978161de2a782cf3bc735ce8d6ca3f))
10-
* **deps:** update dependency move-file to v3 ([#62](https://github.com/braze-inc/cypress-plugin-visual-regression-diff/issues/62)) ([4f6eaf6](https://github.com/braze-inc/cypress-plugin-visual-regression-diff/commit/4f6eaf64a0f3db6e54190ef7532059a451ad384f))
11-
* **deps:** update dependency pixelmatch to v5.3.0 ([#55](https://github.com/braze-inc/cypress-plugin-visual-regression-diff/issues/55)) ([ca5d278](https://github.com/braze-inc/cypress-plugin-visual-regression-diff/commit/ca5d2784a5fffb60bebe7643f8beced6ad9979bd))
12-
* **deps:** update dependency sharp to v0.31.1 ([#132](https://github.com/braze-inc/cypress-plugin-visual-regression-diff/issues/132)) ([15f0f5d](https://github.com/braze-inc/cypress-plugin-visual-regression-diff/commit/15f0f5d2824cba32d4611289442abd637d8438f5))
13-
* **deps:** update dependency vue to v3.2.38 ([#101](https://github.com/braze-inc/cypress-plugin-visual-regression-diff/issues/101)) ([e2d3c82](https://github.com/braze-inc/cypress-plugin-visual-regression-diff/commit/e2d3c823822ecb6738202599500435cf59f2f6d1))
14-
* **deps:** update dependency vue to v3.2.39 ([#110](https://github.com/braze-inc/cypress-plugin-visual-regression-diff/issues/110)) ([8a7f055](https://github.com/braze-inc/cypress-plugin-visual-regression-diff/commit/8a7f0555b1d664b83c7de64d93796408646704eb))
15-
* **deps:** update dependency vue to v3.2.40 ([#131](https://github.com/braze-inc/cypress-plugin-visual-regression-diff/issues/131)) ([537fd16](https://github.com/braze-inc/cypress-plugin-visual-regression-diff/commit/537fd16c4507c394998c0c7f0da7cff18e2d35c5))
16-
* image diff calculation ([529cb22](https://github.com/braze-inc/cypress-plugin-visual-regression-diff/commit/529cb22a22200af234bdbc1399b6f97880001d12)), closes [#107](https://github.com/braze-inc/cypress-plugin-visual-regression-diff/issues/107)
17-
* proper readme info ([dd87e19](https://github.com/braze-inc/cypress-plugin-visual-regression-diff/commit/dd87e19429fe232bd9027737ff7e218c52d8eb06))
18-
* remove alias leftovers from dist bundles ([407ce79](https://github.com/braze-inc/cypress-plugin-visual-regression-diff/commit/407ce79c6a6e00b509fd504f4cf615b3e3c504c3))
19-
* remove automated screenshots update ([acb3ef0](https://github.com/braze-inc/cypress-plugin-visual-regression-diff/commit/acb3ef08fb8ec5129bee9883431361dd804d23f3))
20-
* reset name cache after tests run ([bfbf138](https://github.com/braze-inc/cypress-plugin-visual-regression-diff/commit/bfbf138fa52de06072db32a0181821b56ca5230f))
21-
* sanitize screenshot filenames ([fc57380](https://github.com/braze-inc/cypress-plugin-visual-regression-diff/commit/fc57380d40e72eec51d5fdf2615226a358efa070))
22-
* security vulnerabilities ([d0bda44](https://github.com/braze-inc/cypress-plugin-visual-regression-diff/commit/d0bda44d3055cd578381406a06607bfba48ff447))
23-
* security vulnerability ([d6f849c](https://github.com/braze-inc/cypress-plugin-visual-regression-diff/commit/d6f849cb017e452d9f121866a6429d4bee4b5f18))
24-
* text overflowing when image is small ([3b04f8e](https://github.com/braze-inc/cypress-plugin-visual-regression-diff/commit/3b04f8e1782754c4c48e946ebdb2f43ccfec9461))
13+
* typings for older typescript ([#170](https://github.com/FRSOURCE/cypress-plugin-visual-regression-diff/issues/170)) ([96499ec](https://github.com/FRSOURCE/cypress-plugin-visual-regression-diff/commit/96499ecc2959bab8c39b599ba7eb87fbd79ceec3)), closes [#167](https://github.com/FRSOURCE/cypress-plugin-visual-regression-diff/issues/167)
2514

15+
## [3.0.3](https://github.com/FRSOURCE/cypress-plugin-visual-regression-diff/compare/v3.0.2...v3.0.3) (2022-11-01)
2616

27-
### Features
2817

29-
* add forceDeviceFactor option ([8d69632](https://github.com/braze-inc/cypress-plugin-visual-regression-diff/commit/8d6963222f924d73fc0aed08adecdb361104c2dc))
30-
* add matchAgainstPath option ([#146](https://github.com/braze-inc/cypress-plugin-visual-regression-diff/issues/146)) ([7a5e3a8](https://github.com/braze-inc/cypress-plugin-visual-regression-diff/commit/7a5e3a8ec5aa766e38ee372e11a6d1c155105126)), closes [#88](https://github.com/braze-inc/cypress-plugin-visual-regression-diff/issues/88)
31-
* add possibility to change images dirname ([b831e94](https://github.com/braze-inc/cypress-plugin-visual-regression-diff/commit/b831e94677df906f0cbd889f7ce0994e1e8a7783))
32-
* add queue flushing in after block ([70f828f](https://github.com/braze-inc/cypress-plugin-visual-regression-diff/commit/70f828ff68c4de276dd10c64ab61fece573d305f))
33-
* add title option to matchImage command ([#81](https://github.com/braze-inc/cypress-plugin-visual-regression-diff/issues/81)) ([4d03866](https://github.com/braze-inc/cypress-plugin-visual-regression-diff/commit/4d03866f7f171473b16b4a7c869fbca02d5f46d1))
34-
* add typings ([0a0e8e6](https://github.com/braze-inc/cypress-plugin-visual-regression-diff/commit/0a0e8e63ba1df0f95cf81ba6b0b34a095a0b69be))
35-
* auto clean unused files ([#124](https://github.com/braze-inc/cypress-plugin-visual-regression-diff/issues/124)) ([38679a7](https://github.com/braze-inc/cypress-plugin-visual-regression-diff/commit/38679a730edc4083b4bc751b19bc161bbb72d159)), closes [#118](https://github.com/braze-inc/cypress-plugin-visual-regression-diff/issues/118)
36-
* don't override screenshots if not needed ([9066017](https://github.com/braze-inc/cypress-plugin-visual-regression-diff/commit/90660179d05f4de1c803888fb66f8e1c240f7c37))
37-
* externalize important APIs ([9f94086](https://github.com/braze-inc/cypress-plugin-visual-regression-diff/commit/9f9408657e7970bdad5dfc7a599943a34a779ab7))
38-
* first implementation ([388cccf](https://github.com/braze-inc/cypress-plugin-visual-regression-diff/commit/388cccf5f033010e4de9f88294f5fca30c6d0cd1))
39-
* img diff when resolution differs ([#108](https://github.com/braze-inc/cypress-plugin-visual-regression-diff/issues/108)) ([c8a5044](https://github.com/braze-inc/cypress-plugin-visual-regression-diff/commit/c8a504480d09f6ffd34321163bf14b1a2f0e7bb0)), closes [#94](https://github.com/braze-inc/cypress-plugin-visual-regression-diff/issues/94)
40-
* introduce imagesPath option ([#152](https://github.com/braze-inc/cypress-plugin-visual-regression-diff/issues/152)) ([961e137](https://github.com/braze-inc/cypress-plugin-visual-regression-diff/commit/961e137099ba22aa9f0b6d36e6e73d495196a764)), closes [#147](https://github.com/braze-inc/cypress-plugin-visual-regression-diff/issues/147)
41-
* make library cypress 10 compatible ([b26beb3](https://github.com/braze-inc/cypress-plugin-visual-regression-diff/commit/b26beb391cf440d2d4b01261271b7acffa6f600e))
42-
* make plugin Cypress 10 compatible ([a03a17d](https://github.com/braze-inc/cypress-plugin-visual-regression-diff/commit/a03a17d7295dd811969c10ad562dda26795fd8f2))
43-
* migrate to @frsource/base64 package ([e4f3a14](https://github.com/braze-inc/cypress-plugin-visual-regression-diff/commit/e4f3a14575648b76d4f41eeb5984b853b968c974))
44-
* provide modern exports ([5c911a1](https://github.com/braze-inc/cypress-plugin-visual-regression-diff/commit/5c911a113624cea79e8b09eba2e643954a04a057))
45-
* show comparison for successful tests ([#137](https://github.com/braze-inc/cypress-plugin-visual-regression-diff/issues/137)) ([c09bab3](https://github.com/braze-inc/cypress-plugin-visual-regression-diff/commit/c09bab3ef805de24fc7cbcc8c738137c35e3fe18)), closes [#104](https://github.com/braze-inc/cypress-plugin-visual-regression-diff/issues/104)
46-
* show scrollbar for overflowing images ([de994b9](https://github.com/braze-inc/cypress-plugin-visual-regression-diff/commit/de994b98ad3dea233aee70b0142992a309476e38))
47-
* stop logging all of the tasks ([573e728](https://github.com/braze-inc/cypress-plugin-visual-regression-diff/commit/573e7282799c802b0f6e9ecbe66501d043745ac3))
18+
### Bug Fixes
4819

20+
* ts declaration generation ([1a1e0cc](https://github.com/FRSOURCE/cypress-plugin-visual-regression-diff/commit/1a1e0ccd4c442d3e4d45f4d899139a08963e0c85))
4921

50-
### BREAKING CHANGES
22+
## [3.0.2](https://github.com/FRSOURCE/cypress-plugin-visual-regression-diff/compare/v3.0.1...v3.0.2) (2022-10-27)
5123

52-
* deprecate imagesDir option in favor of imagesPath - see docs for additional information
53-
* To use autocleanup feature you need to update all of the screenshots, best do it by running your test suite with cypress env 'pluginVisualRegressionUpdateImages' set to true.
54-
* matchImage returns object containing comparison details from now on (previously was returning subject element from a chain)
55-
* different resolution doesn't fail test immediately - img diff is being done
24+
25+
### Bug Fixes
26+
27+
* **deps:** update all non-major dependencies ([#165](https://github.com/FRSOURCE/cypress-plugin-visual-regression-diff/issues/165)) ([602640f](https://github.com/FRSOURCE/cypress-plugin-visual-regression-diff/commit/602640fcca6e8173930efa116244258549aa5264))
5628

5729
## [3.0.1](https://github.com/FRSOURCE/cypress-plugin-visual-regression-diff/compare/v3.0.0...v3.0.1) (2022-10-26)
5830

CONTRIBUTING.md

+5-2
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,7 @@ Don’t hesitate to ask a question directly on the [discussions board](https://g
2929
- We have no preference about number of commits on the PR - they will be all squashed by GitHub while merging
3030

3131
- When creating a new feature/plugin/integration:
32+
3233
- Make sure the feature is covered by tests
3334
- Provide a meaningful description. In most cases it would make sens to first open a issue with a suggestion, discuss about it and have it approved before working on it
3435

@@ -40,12 +41,14 @@ Don’t hesitate to ask a question directly on the [discussions board](https://g
4041
## Development Setup
4142

4243
<!-- textlint-disable spelling -->
44+
4345
You will need [Node.js](https://nodejs.org/en/) **version 16+** and [yarn](https://yarnpkg.com/getting-started/install).
46+
4447
<!-- textlint-enable -->
4548

4649
After cloning the repository, run:
4750

48-
``` bash
51+
```bash
4952
yarn i # installs the project dependencies
5053
cd example && yarn i # install dependencies for example project (useful for testing)
5154
```
@@ -58,7 +61,7 @@ Commit messages should follow the [conventional commits v1.0.0](https://www.conv
5861

5962
When fired in the project root they will run corresponding actions in every nested package at once.
6063

61-
``` bash
64+
```bash
6265
# build the project for NPM and example usage
6366
$ yarn build
6467

README.md

+29-21
Original file line numberDiff line numberDiff line change
@@ -71,54 +71,63 @@ npm install --save-dev @frsource/cypress-plugin-visual-regression-diff
7171
Next, you need to import the library:
7272

7373
- first, in your support file (located by default in `cypress/support/index.js`):
74+
7475
```ts
7576
// typescript / ES6
76-
import '@frsource/cypress-plugin-visual-regression-diff';
77+
import "@frsource/cypress-plugin-visual-regression-diff";
7778

7879
// javascript
79-
require('@frsource/cypress-plugin-visual-regression-diff');
80+
require("@frsource/cypress-plugin-visual-regression-diff");
8081
```
8182

8283
- secondly:
8384
- (for Cypress 10.0+) in `cypress.config.js` (or `cypress.config.ts`):
85+
8486
```ts
8587
// typescript / ES6
86-
import { defineConfig } from 'cypress';
87-
import { initPlugin } from '@frsource/cypress-plugin-visual-regression-diff/plugins';
88+
import { defineConfig } from "cypress";
89+
import { initPlugin } from "@frsource/cypress-plugin-visual-regression-diff/plugins";
8890

8991
export default defineConfig({
9092
// initPlugin must be called in the section where it is used: e2e or component
9193
e2e: {
9294
setupNodeEvents(on, config) {
9395
initPlugin(on, config);
94-
}
96+
},
9597
},
9698
component: {
9799
setupNodeEvents(on, config) {
98100
initPlugin(on, config);
99-
}
100-
}
101+
},
102+
},
101103
});
102104
```
103-
- (for Cypress <10.0) in your plugins file (located by default in `cypress/plugins/index.js`):
105+
106+
- (for Cypress <10.0) in your plugins file (located by default in `cypress/plugins/index.js`):
107+
104108
```ts
105109
// typescript / ES6
106-
import { initPlugin } from '@frsource/cypress-plugin-visual-regression-diff/plugins';
110+
import { initPlugin } from "@frsource/cypress-plugin-visual-regression-diff/plugins";
107111

108-
export default function (on: Cypress.PluginEvents, config: Cypress.PluginConfigOptions) {
112+
export default function (
113+
on: Cypress.PluginEvents,
114+
config: Cypress.PluginConfigOptions
115+
) {
109116
initPlugin(on, config);
110117

111118
return config;
112-
};
119+
}
113120

114121
// javascript
115-
const { initPlugin } = require('@frsource/cypress-plugin-visual-regression-diff/plugins');
122+
const {
123+
initPlugin,
124+
} = require("@frsource/cypress-plugin-visual-regression-diff/plugins");
116125

117126
module.exports = function (on, config) {
118127
initPlugin(on, config);
119128

120129
return config;
121-
}
130+
};
122131
```
123132

124133
That's it - now let's see how to use the library in [usage section](#usage).
@@ -128,7 +137,7 @@ That's it - now let's see how to use the library in [usage section](#usage).
128137
Once installed, the library might be used by writing in your test:
129138

130139
```ts
131-
cy.get('.an-element-of-your-choice').matchImage();
140+
cy.get(".an-element-of-your-choice").matchImage();
132141
```
133142

134143
Or, if you would like to make a screenshot of whole document:
@@ -210,16 +219,15 @@ npx cypress run --env "pluginVisualRegressionUpdateImages=true,pluginVisualRegre
210219

211220
```ts
212221
// cypress.config.ts
213-
import { defineConfig } from 'cypress';
222+
import { defineConfig } from "cypress";
214223

215224
export default defineConfig({
216225
env: {
217226
pluginVisualRegressionUpdateImages: true,
218-
pluginVisualRegressionDiffConfig: { threshold: 0.01 }
219-
}
220-
})
227+
pluginVisualRegressionDiffConfig: { threshold: 0.01 },
228+
},
229+
});
221230
{
222-
223231
}
224232
```
225233

@@ -239,8 +247,8 @@ For more ways of setting environment variables [take a look here](https://docs.c
239247

240248
Screenshots in Cypress do not scale to the viewport size by default. You can change this behavior:
241249

242-
* globally, by changing default screenshot configuration: <code>Cypress.Screenshot.defaults({ capture: 'viewport' });</code>
243-
* locally, by passing screenshot configuration directly to the <code>.matchImage</code> command: <code>cy.matchImage({ screenshotConfig: { capture: 'viewport' } });</code>
250+
- globally, by changing default screenshot configuration: <code>Cypress.Screenshot.defaults({ capture: 'viewport' });</code>
251+
- locally, by passing screenshot configuration directly to the <code>.matchImage</code> command: <code>cy.matchImage({ screenshotConfig: { capture: 'viewport' } });</code>
244252

245253
</details>
246254

Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
1-
describe('Cleanup test', () => {
2-
it('Create screenshot to be removed', () => {
3-
cy.visit('/');
1+
describe("Cleanup test", () => {
2+
it("Create screenshot to be removed", () => {
3+
cy.visit("/");
44
cy.get('[data-testid="description"]').matchImage();
55
});
66
});

example/cypress.config.js

-24
This file was deleted.

example/cypress.config.ts

+22
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
import { defineConfig } from "cypress";
2+
import { initPlugin } from "@frsource/cypress-plugin-visual-regression-diff/plugins";
3+
4+
module.exports = defineConfig({
5+
video: false,
6+
e2e: {
7+
setupNodeEvents(on, config) {
8+
initPlugin(on, config);
9+
},
10+
specPattern: "cypress/e2e/**/*.cy.{js,jsx,ts,tsx}",
11+
},
12+
13+
component: {
14+
setupNodeEvents(on, config) {
15+
initPlugin(on, config);
16+
},
17+
devServer: {
18+
framework: "vue-cli",
19+
bundler: "webpack",
20+
},
21+
},
22+
});

0 commit comments

Comments
 (0)