From 4ce36d2680cf5d688cb0c3a2b9c492b82327c1a5 Mon Sep 17 00:00:00 2001 From: shaodahong Date: Sat, 14 Nov 2020 12:34:45 +0800 Subject: [PATCH] increase timeout --- .jest.image.js | 1 + docker-compose.yml | 1 + jest-puppeteer.config.js | 2 -- tests/shared/imageTest.ts | 24 +++++++++++------------- 4 files changed, 13 insertions(+), 15 deletions(-) diff --git a/.jest.image.js b/.jest.image.js index 263dcec864..6e3c1f2b46 100644 --- a/.jest.image.js +++ b/.jest.image.js @@ -20,4 +20,5 @@ module.exports = { }, }, preset: 'jest-puppeteer', + testTimeout: 10000, }; diff --git a/docker-compose.yml b/docker-compose.yml index 85e2b7d878..782dbaf70e 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -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" diff --git a/jest-puppeteer.config.js b/jest-puppeteer.config.js index 668abfb923..fb644512ed 100644 --- a/jest-puppeteer.config.js +++ b/jest-puppeteer.config.js @@ -10,6 +10,4 @@ module.exports = { '--disable-dev-shm-usage', ], }, - browser: 'chromium', - browserContext: 'default', }; diff --git a/tests/shared/imageTest.ts b/tests/shared/imageTest.ts index 55c423ff3c..dd7c36016e 100644 --- a/tests/shared/imageTest.ts +++ b/tests/shared/imageTest.ts @@ -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(); }); }