mirror of
https://gitee.com/ant-design/ant-design.git
synced 2024-11-30 02:59:04 +08:00
test: improve argos-ci test (#27420)
This commit is contained in:
parent
cc8ec58ab1
commit
e9163b3eae
@ -5,6 +5,8 @@ import puppeteer, { Browser, Page } from 'puppeteer';
|
|||||||
import { configureToMatchImageSnapshot } from 'jest-image-snapshot';
|
import { configureToMatchImageSnapshot } from 'jest-image-snapshot';
|
||||||
import ReactDOMServer from 'react-dom/server';
|
import ReactDOMServer from 'react-dom/server';
|
||||||
import glob from 'glob';
|
import glob from 'glob';
|
||||||
|
import MockDate from 'mockdate';
|
||||||
|
import moment from 'moment';
|
||||||
|
|
||||||
const toMatchImageSnapshot = configureToMatchImageSnapshot({
|
const toMatchImageSnapshot = configureToMatchImageSnapshot({
|
||||||
customSnapshotsDir: `${process.cwd()}/imageSnapshots`,
|
customSnapshotsDir: `${process.cwd()}/imageSnapshots`,
|
||||||
@ -20,6 +22,7 @@ export default function imageTest(component: React.ReactElement) {
|
|||||||
let page: Page;
|
let page: Page;
|
||||||
|
|
||||||
beforeAll(async () => {
|
beforeAll(async () => {
|
||||||
|
MockDate.set(moment('2016-11-22').valueOf());
|
||||||
browser = await puppeteer.launch({
|
browser = await puppeteer.launch({
|
||||||
args: [
|
args: [
|
||||||
// Required for Docker version of Puppeteer
|
// Required for Docker version of Puppeteer
|
||||||
@ -37,6 +40,7 @@ export default function imageTest(component: React.ReactElement) {
|
|||||||
|
|
||||||
afterAll(() => {
|
afterAll(() => {
|
||||||
browser.close();
|
browser.close();
|
||||||
|
MockDate.reset();
|
||||||
});
|
});
|
||||||
|
|
||||||
it('component image screenshot should correct', async () => {
|
it('component image screenshot should correct', async () => {
|
||||||
|
Loading…
Reference in New Issue
Block a user