Skip to content

Commit

Permalink
increase timeout
Browse files Browse the repository at this point in the history
  • Loading branch information
shaodahong committed Nov 14, 2020
1 parent 427817f commit 4ce36d2
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 15 deletions.
1 change: 1 addition & 0 deletions .jest.image.js
Original file line number Diff line number Diff line change
Expand Up @@ -20,4 +20,5 @@ module.exports = {
},
},
preset: 'jest-puppeteer',
testTimeout: 10000,
};
1 change: 1 addition & 0 deletions docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ services:
- './jest-stare:/app/jest-stare'
- './dist:/app/dist'
- '.jest.image.js:/app/.jest.image.js'
- './jest-puppeteer.config.js:/app/jest-puppeteer.config.js'
- './imageSnapshots:/app/imageSnapshots'
- './imageDiffSnapshots:/app/imageDiffSnapshots'
entrypoint: "jest --config .jest.image.js --no-cache -i"
2 changes: 0 additions & 2 deletions jest-puppeteer.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,4 @@ module.exports = {
'--disable-dev-shm-usage',
],
},
browser: 'chromium',
browserContext: 'default',
};
24 changes: 11 additions & 13 deletions tests/shared/imageTest.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,22 +16,20 @@ expect.extend({ toMatchImageSnapshot });

// eslint-disable-next-line jest/no-export
export default function imageTest(component: React.ReactElement) {
describe(`Image test`, () => {
it('component image screenshot should correct', async () => {
MockDate.set(moment('2016-11-22').valueOf());
await page.goto(`file://${process.cwd()}/tests/index.html`);
await page.addStyleTag({ path: `${process.cwd()}/dist/antd.css` });
const html = ReactDOMServer.renderToString(component);
await page.evaluate(innerHTML => {
document.querySelector('#root')!.innerHTML = innerHTML;
}, html);
it('component image screenshot should correct', async () => {
MockDate.set(moment('2016-11-22').valueOf());
await page.goto(`file://${process.cwd()}/tests/index.html`);
await page.addStyleTag({ path: `${process.cwd()}/dist/antd.css` });
const html = ReactDOMServer.renderToString(component);
await page.evaluate(innerHTML => {
document.querySelector('#root')!.innerHTML = innerHTML;
}, html);

const image = await page.screenshot();
const image = await page.screenshot();

expect(image).toMatchImageSnapshot();
expect(image).toMatchImageSnapshot();

MockDate.reset();
});
MockDate.reset();
});
}

Expand Down

0 comments on commit 4ce36d2

Please sign in to comment.