提交 d9adfc53 编写于 作者: Anne_LXM's avatar Anne_LXM

test:screenshot

上级 351f872b
const path = require("path");
const fs = require("fs");
const {configureToMatchImageSnapshot} = require('jest-image-snapshot');
const {
configureToMatchImageSnapshot
} = require('jest-image-snapshot');
let saveImageSnapshotDir = process.env.saveImageSnapshotDir || path.join(__dirname, '__snapshot__');
expect.extend({
// toMatchImageSnapshot: configureToMatchImageSnapshot({
// customSnapshotIdentifier(args) {
// return args.currentTestName.replace(/\//g, "-").replace(" ", "-");
// },
// customSnapshotsDir: process.env.saveImageSnapshotDir,
// customDiffDir: path.join(saveImageSnapshotDir, "diff"),
// }),
toMatchImageSnapshot: configureToMatchImageSnapshot({
customSnapshotIdentifier(args) {
return args.currentTestName.replace(/\//g, "-").replace(" ", "-");
},
customSnapshotsDir: process.env.saveImageSnapshotDir,
customDiffDir: path.join(saveImageSnapshotDir, "diff"),
}),
toSaveSnapshot,
toSaveImageSnapshot,
});
......
......@@ -26,7 +26,7 @@ describe('page screenshot test', () => {
console.log("page screenshot test finish");
});
test.each(pages)('%s', async () => {
const image = await program.screenshot({deviceShot:true,fullPage:true});
const image = await program.screenshot();
expect(image).toSaveImageSnapshot();
await page.waitFor(500);
})
......
......@@ -32,7 +32,7 @@ describe('settings', () => {
}
})
it('screenshot', async () => {
const image = await program.screenshot({deviceShot:true,fullPage:true});
const image = await program.screenshot();
expect(image).toSaveImageSnapshot();
await page.waitFor(500);
})
......
......@@ -57,7 +57,7 @@ describe('ucenter', () => {
}
})
it('screenshot', async () => {
const image = await program.screenshot({deviceShot:true,fullPage:true});
const image = await program.screenshot();
expect(image).toSaveImageSnapshot();
await page.waitFor(500);
})
......
......@@ -30,7 +30,7 @@ describe('userinfo', () => {
expect(userInfo.nickname).toBe(nickname)
})
it('screenshot', async () => {
const image = await program.screenshot({deviceShot:true,fullPage:true});
const image = await program.screenshot();
expect(image).toSaveImageSnapshot();
await page.waitFor(500);
})
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册