Skip to content

Commit 179e4cd

Browse files
authored
Merge pull request #23 from NimaSoroush/update-readme
Update Readme and bug fixes
2 parents b9d4e22 + 4819e08 commit 179e4cd

File tree

9 files changed

+43
-9
lines changed

9 files changed

+43
-9
lines changed

CHANGELOG.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,8 @@
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

README.md

Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
<p align="center"><img alt="Differencify" src="http://i.imgur.com/D0Eapjx.png" width="150">
1+
<p align="center"><img alt="Differencify" src="images/logo.png" width="150">
22
<br>
33
<strong>Differencify</strong>
44
<br>
@@ -9,8 +9,12 @@ Regression Testing suite!
99
Status: [![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="images/reference_screenshot.png" width="400">|<img alt="Differencify" src="images/differencified_screenshot.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="images/update.gif" width="500">
42+
</p>
43+
3644
### Validate your changes
3745
```js
3846
async () => {
3947
const result = await differencify.test(TestOptions);
4048
console.log(result); //true if test pass
4149
}
4250
```
51+
<p align="center">
52+
<img src="images/test.gif" width="500">
53+
</p>
4354

4455
### API
4556

20.6 KB
Loading

images/logo.png

315 Bytes
Loading

images/reference_screenshot.png

48.9 KB
Loading

images/test.gif

287 KB
Loading

images/update.gif

560 KB
Loading

src/compareImage.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff 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

src/compareImage.test.js

Lines changed: 24 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -59,18 +59,36 @@ describe('Compare Image', () => {
5959
expect(result).toEqual('no mismatch found ✅');
6060
});
6161

62-
it('returns correct value if only difference above threshold', async () => {
62+
it('returns mismatch found❗ 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

69-
it('returns correct value if only distance above threshold', async () => {
78+
it('returns mismatch found❗ 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 () => {

0 commit comments

Comments
 (0)