File tree Expand file tree Collapse file tree 4 files changed +41
-7
lines changed
Expand file tree Collapse file tree 4 files changed +41
-7
lines changed Original file line number Diff line number Diff line change 1+ ## [ 0.0.13] - 2017-07-25
2+ ### Added
3+ - Updating readme file
4+ - Bug fixes
5+
16## [ 0.0.12] - 2017-07-24
27### Added
38- Added wait functionality
Original file line number Diff line number Diff line change 1- <p align =" center " ><img alt =" Differencify " src =" http://i.imgur.com/D0Eapjx .png " width =" 150 " >
1+ <p align =" center " ><img alt =" Differencify " src =" http://i.imgur.com/0zwMggK .png " width =" 150 " >
22<br >
33<strong >Differencify</strong >
44<br >
@@ -9,8 +9,12 @@ Regression Testing suite!
99Status: [ ![ CircleCI] ( https://circleci.com/gh/NimaSoroush/differencify/tree/master.svg?style=svg )] ( https://circleci.com/gh/NimaSoroush/differencify/tree/master )
1010
1111## About
12+ Differencify is a library for visual regression testing by comparing your local changes with reference screenshots of your website.
13+
14+ | Reference| Local changes|
15+ | ---------| -------------|
16+ | <img alt =" Differencify " src =" http://i.imgur.com/Vq0sVY1.png " width =" 400 " >| <img alt =" Differencify " src =" http://i.imgur.com/Ry11AHE.png " width =" 400 " >|
1217
13- Differencify is library for visual regression testing by comparing your local changes with reference screenshots of your website.
1418
1519## Requirements
1620- Node > 6
@@ -33,13 +37,20 @@ async () => {
3337 console .log (result); // true if update succeeded
3438}
3539```
40+ <p align =" center " >
41+ <img src =" https://thumbs.gfycat.com/HandmadeGrayFirecrest-size_restricted.gif " width =" 500 " >
42+ </p >
43+
3644### Validate your changes
3745``` js
3846async () => {
3947 const result = await differencify .test (TestOptions);
4048 console .log (result); // true if test pass
4149}
4250```
51+ <p align =" center " >
52+ <img src =" https://thumbs.gfycat.com/UnknownVariableGrayling-size_restricted.gif " width =" 500 " >
53+ </p >
4354
4455### API
4556
Original file line number Diff line number Diff line change @@ -24,7 +24,7 @@ const compareImage = async (options, testName) => {
2424
2525 const distance = Jimp . distance ( referenceImage , testImage ) ;
2626 const diff = Jimp . diff ( referenceImage , testImage , options . mismatchThreshold ) ;
27- if ( distance < options . mismatchThreshold || diff . percent < options . mismatchThreshold ) {
27+ if ( distance < options . mismatchThreshold && diff . percent < options . mismatchThreshold ) {
2828 return 'no mismatch found ✅' ;
2929 }
3030
Original file line number Diff line number Diff line change @@ -60,17 +60,35 @@ describe('Compare Image', () => {
6060 } ) ;
6161
6262 it ( 'returns correct value if only difference above threshold' , async ( ) => {
63+ expect . assertions ( 1 ) ;
6364 Jimp . diff . mockReturnValue ( { percent : 0.02 } ) ;
6465
65- const result = await compareImage ( mockConfig , 'test' ) ;
66- expect ( result ) . toEqual ( 'no mismatch found ✅' ) ;
66+ try {
67+ await compareImage ( mockConfig , 'test' ) ;
68+ } catch ( err ) {
69+ expect ( err . message ) . toEqual ( `mismatch found❗
70+ Result:
71+ distance: 0
72+ diff: 0.02
73+ misMatchThreshold: 0.01
74+ ` ) ;
75+ }
6776 } ) ;
6877
6978 it ( 'returns correct value if only distance above threshold' , async ( ) => {
79+ expect . assertions ( 1 ) ;
7080 Jimp . distance . mockReturnValue ( 0.02 ) ;
7181
72- const result = await compareImage ( mockConfig , 'test' ) ;
73- expect ( result ) . toEqual ( 'no mismatch found ✅' ) ;
82+ try {
83+ await compareImage ( mockConfig , 'test' ) ;
84+ } catch ( err ) {
85+ expect ( err . message ) . toEqual ( `mismatch found❗
86+ Result:
87+ distance: 0.02
88+ diff: 0
89+ misMatchThreshold: 0.01
90+ ` ) ;
91+ }
7492 } ) ;
7593
7694 it ( 'throws error if distance and difference are above threshold' , async ( ) => {
You can’t perform that action at this time.
0 commit comments