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

test:screenshot

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