Skip to content

Commit 3b67eef

Browse files
committed
Added cleanup functionality and circleci integration
1 parent 7cd1e0b commit 3b67eef

16 files changed

+211
-167
lines changed

.circleci/config.yml

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
version: 2
2+
jobs:
3+
build:
4+
docker:
5+
- image: circleci/node:7
6+
steps:
7+
- checkout
8+
- restore_cache:
9+
key: dependency-cache-{{ checksum "package.json" }}
10+
- run:
11+
name: install-packages
12+
command: npm install
13+
- save_cache:
14+
key: dependency-cache-{{ checksum "package.json" }}
15+
paths:
16+
- .node_modules
17+
- run:
18+
name: test
19+
command: npm test
20+
21+
workflows:
22+
version: 2
23+
build_and_test:
24+
jobs:
25+
- build

API.md

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
### Methods
2+
3+
|Method|Arguments|description|
4+
|------|---------|-----------|
5+
|`update`|[TestOptions](https://github.com/NimaSoroush/differencify#testoptions)|Creates reference screenshots|
6+
|`test`|[TestOptions](https://github.com/NimaSoroush/differencify#testoptions)|Validate your changes by testing against reference screenshots|
7+
|`cleanup`|no argument|Closes all leftover browser instances|

CHANGELOG.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,8 @@
1+
## [0.0.11] - 2017-07-21
2+
### Added
3+
- Added cleanup functionality
4+
- Added circleci to project
5+
16
## [0.0.10] - 2017-07-07
27
### Added
38
- Added chromy.screenshot()

README.md

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,18 +6,20 @@ Regression Testing suite!
66
</p>
77
<br>
88

9+
Status: [![CircleCI](https://circleci.com/gh/NimaSoroush/differencify/tree/master.svg?style=svg)](https://circleci.com/gh/NimaSoroush/differencify/tree/master)
10+
911
## About
1012

1113
Differencify is library for visual regression testing by comparing your locall changes with reference screenshots of your website.
1214

1315
## Requirements
1416
- Node > 6
15-
- Chrome > 59 or [Chrome Canary](https://confluence.skyscannertools.net/display/DW/Shared+Cache+Client)
17+
- Chrome > 59 or [Chrome Canary](https://www.google.co.uk/chrome/browser/canary.html)
1618

1719
## Installation
1820
Install the module:
1921
```bash
20-
npm install --save-dev differencify
22+
npm install differencify
2123
```
2224
## Usage
2325
```js
@@ -39,6 +41,10 @@ async () => {
3941
}
4042
```
4143

44+
### API
45+
46+
See [API.md](API.md) for full list of API calls
47+
4248
### GlobalOptions
4349

4450
|Parameter|type|required|description|default|

examples/configs/global-config.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
export default {
1+
exports.default = {
22
screenshots: './screenshots',
33
debug: false,
44
visible: true,

examples/configs/test-config.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
export default {
1+
exports.default = {
22
name: 'default',
33
resolution: {
44
width: 1366,

examples/example-test.js

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,10 @@
11
const Differencify = require('differencify');
2-
const globalConfig = require('./configs/global-config');
3-
const testConfig = require('./configs/test-config');
2+
const globalConfig = require('./configs/global-config').default;
3+
const testConfig = require('./configs/test-config').default;
44

55
const differencify = new Differencify(globalConfig);
66

7-
differencify.test(testConfig).then((r) => {
8-
console.log(r);
7+
differencify.test(testConfig).then((result) => {
8+
console.log(result); // true or false
9+
differencify.cleanup();
910
});

examples/example-update.js

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,10 @@
11
const Differencify = require('differencify');
2-
const globalConfig = require('./configs/global-config');
3-
const testConfig = require('./configs/test-config');
2+
const globalConfig = require('./configs/global-config').default;
3+
const testConfig = require('./configs/test-config').default;
44

55
const differencify = new Differencify(globalConfig);
66

7-
differencify.update(testConfig).then((r) => {
8-
console.log(r);
7+
differencify.update(testConfig).then((result) => {
8+
console.log(result); // true or false
9+
differencify.cleanup();
910
});

examples/jest-example.js

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,11 +2,14 @@ import Differencify from 'differencify';
22
import globalConfig from './configs/global-config';
33
import testConfig from './configs/test-config';
44

5-
const differencify = new Differencify(globalConfig);
5+
const differencify = new Differencify(globalConfig.default);
66

77
describe('My website', () => {
8+
afterAll(() => {
9+
differencify.cleanup();
10+
});
811
it('validate visual regression test', async () => {
9-
const result = await differencify.test(testConfig);
12+
const result = await differencify.test(testConfig.default);
1013
expect(result).toEqual(true);
1114
}, 30000);
1215
});

package.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "differencify",
3-
"version": "0.0.10",
3+
"version": "0.0.11",
44
"description": "Perceptual diffing tool",
55
"main": "dist/index.js",
66
"scripts": {
@@ -33,7 +33,7 @@
3333
"babel-preset-env": "^1.5.2",
3434
"babel-preset-es2015": "^6.24.1",
3535
"babel-preset-jest": "^20.0.3",
36-
"eslint": "^3.10.2",
36+
"eslint": "^3.19.0",
3737
"eslint-config-airbnb": "^13.0.0",
3838
"eslint-plugin-import": "^2.2.0",
3939
"eslint-plugin-jsx-a11y": "^2.2.3",

0 commit comments

Comments
 (0)