Skip to content

Commit

Permalink
feat: Refactor the ui visual regression
Browse files Browse the repository at this point in the history
  • Loading branch information
dabeng committed Oct 6, 2019
1 parent eca70c9 commit 09f43ae
Show file tree
Hide file tree
Showing 6 changed files with 16 additions and 6 deletions.
2 changes: 1 addition & 1 deletion .travis.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
language: node_js
node_js: "6"
node_js: "8"

before_install:
- stty cols 80
Expand Down
2 changes: 1 addition & 1 deletion package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "orgchart",
"version": "2.1.6",
"version": "2.1.7",
"description": "Simple and direct organization chart(tree-like hierarchy) plugin based on pure DOM and jQuery.",
"main": "./dist/js/jquery.orgchart.min.js",
"style": [
Expand Down
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
16 changes: 13 additions & 3 deletions test/visual-regression/zoom/test.js
Original file line number Diff line number Diff line change
@@ -1,9 +1,19 @@
const { toMatchImageSnapshot } = require("jest-image-snapshot");
const { toMatchImageSnapshot } = require('jest-image-snapshot');

expect.extend({ toMatchImageSnapshot });

const config = {
failureThreshold: 0.01,
failureThresholdType: 'percent'
};

describe('orgchart -- visual regression tests', () => {
beforeAll(async () => {
await page.setViewport({
width: 1680,
height: 450,
deviceScaleFactor: 1,
});
await page.goto(
`file:${require('path').join(__dirname, '../../../demo/pan-zoom.html')}`
);
Expand All @@ -18,7 +28,7 @@ describe('orgchart -- visual regression tests', () => {
el.dispatchEvent(syntheticEvent);
});
const image = await page.screenshot();
expect(image).toMatchImageSnapshot();
expect(image).toMatchImageSnapshot(config);
});

it('zoomout correctly', async () => {
Expand All @@ -31,6 +41,6 @@ describe('orgchart -- visual regression tests', () => {
el.dispatchEvent(syntheticEvent);
});
const image = await page.screenshot();
expect(image).toMatchImageSnapshot();
expect(image).toMatchImageSnapshot(config);
});
});

0 comments on commit 09f43ae

Please sign in to comment.