Skip to content

Commit 09f43ae

Browse files
committed
feat: Refactor the ui visual regression
1 parent eca70c9 commit 09f43ae

File tree

6 files changed

+16
-6
lines changed

6 files changed

+16
-6
lines changed

.travis.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
language: node_js
2-
node_js: "6"
2+
node_js: "8"
33

44
before_install:
55
- stty cols 80

package-lock.json

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "orgchart",
3-
"version": "2.1.6",
3+
"version": "2.1.7",
44
"description": "Simple and direct organization chart(tree-like hierarchy) plugin based on pure DOM and jQuery.",
55
"main": "./dist/js/jquery.orgchart.min.js",
66
"style": [
9.82 KB
Loading
7.8 KB
Loading

test/visual-regression/zoom/test.js

Lines changed: 13 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,19 @@
1-
const { toMatchImageSnapshot } = require("jest-image-snapshot");
1+
const { toMatchImageSnapshot } = require('jest-image-snapshot');
22

33
expect.extend({ toMatchImageSnapshot });
44

5+
const config = {
6+
failureThreshold: 0.01,
7+
failureThresholdType: 'percent'
8+
};
9+
510
describe('orgchart -- visual regression tests', () => {
611
beforeAll(async () => {
12+
await page.setViewport({
13+
width: 1680,
14+
height: 450,
15+
deviceScaleFactor: 1,
16+
});
717
await page.goto(
818
`file:${require('path').join(__dirname, '../../../demo/pan-zoom.html')}`
919
);
@@ -18,7 +28,7 @@ describe('orgchart -- visual regression tests', () => {
1828
el.dispatchEvent(syntheticEvent);
1929
});
2030
const image = await page.screenshot();
21-
expect(image).toMatchImageSnapshot();
31+
expect(image).toMatchImageSnapshot(config);
2232
});
2333

2434
it('zoomout correctly', async () => {
@@ -31,6 +41,6 @@ describe('orgchart -- visual regression tests', () => {
3141
el.dispatchEvent(syntheticEvent);
3242
});
3343
const image = await page.screenshot();
34-
expect(image).toMatchImageSnapshot();
44+
expect(image).toMatchImageSnapshot(config);
3545
});
3646
});

0 commit comments

Comments
 (0)