提交 1a14443e 编写于 作者: DCloud-WZF's avatar DCloud-WZF 💬

test: 调整截图移除导航栏,适配跨平台对比

上级 c60213fc
...@@ -16,7 +16,7 @@ describe("getElementByIdForMultipleRootNode", () => { ...@@ -16,7 +16,7 @@ describe("getElementByIdForMultipleRootNode", () => {
await page.callMethod("changeTextColor"); await page.callMethod("changeTextColor");
await page.callMethod("changeViewStyle"); await page.callMethod("changeViewStyle");
await page.waitFor(500); await page.waitFor(500);
const image = await program.screenshot(); const image = await program.screenshot({fullPage: true});
expect(image).toSaveImageSnapshot(); expect(image).toSaveImageSnapshot();
}); });
}); });
...@@ -15,7 +15,7 @@ describe("getElementById", () => { ...@@ -15,7 +15,7 @@ describe("getElementById", () => {
await page.callMethod("changeTextColor"); await page.callMethod("changeTextColor");
await page.callMethod("changeViewStyle"); await page.callMethod("changeViewStyle");
await page.waitFor(500); await page.waitFor(500);
const image = await program.screenshot(); const image = await program.screenshot({fullPage: true});
expect(image).toSaveImageSnapshot(); expect(image).toSaveImageSnapshot();
}); });
}); });
...@@ -7,13 +7,13 @@ describe("loadFontFace", () => { ...@@ -7,13 +7,13 @@ describe("loadFontFace", () => {
await page.waitFor(4000); await page.waitFor(4000);
}); });
it("parent screenshot", async () => { it("parent screenshot", async () => {
const image = await program.screenshot(); const image = await program.screenshot({fullPage: true});
expect(image).toSaveImageSnapshot(); expect(image).toSaveImageSnapshot();
}); });
it("child screenshot", async () => { it("child screenshot", async () => {
const page = await program.navigateTo(CHILD_PAGE_PATH); const page = await program.navigateTo(CHILD_PAGE_PATH);
await page.waitFor(3000); await page.waitFor(3000);
const image = await program.screenshot(); const image = await program.screenshot({fullPage: true});
expect(image).toSaveImageSnapshot(); expect(image).toSaveImageSnapshot();
}); });
}); });
...@@ -10,7 +10,7 @@ describe("onLoad", () => { ...@@ -10,7 +10,7 @@ describe("onLoad", () => {
await page.waitFor('view'); await page.waitFor('view');
await page.callMethod("navigateToOnLoadWithType", "adjustData"); await page.callMethod("navigateToOnLoadWithType", "adjustData");
await page.waitFor(1000); await page.waitFor(1000);
const image = await program.screenshot(); const image = await program.screenshot({fullPage: true});
expect(image).toSaveImageSnapshot(); expect(image).toSaveImageSnapshot();
}); });
it("navigateTo", async () => { it("navigateTo", async () => {
......
...@@ -8,14 +8,14 @@ describe('background-image-test', () => { ...@@ -8,14 +8,14 @@ describe('background-image-test', () => {
it('background-image-screenshot', async () => { it('background-image-screenshot', async () => {
await page.waitFor(300); await page.waitFor(300);
const image = await program.screenshot(); const image = await program.screenshot({fullPage: true});
expect(image).toSaveImageSnapshot(); expect(image).toSaveImageSnapshot();
}); });
it('background-image-select', async () => { it('background-image-select', async () => {
await page.callMethod('updateBackgroundSelect') await page.callMethod('updateBackgroundSelect')
await page.waitFor(300); await page.waitFor(300);
const image = await program.screenshot(); const image = await program.screenshot({fullPage: true});
expect(image).toSaveImageSnapshot(); expect(image).toSaveImageSnapshot();
}); });
}); });
...@@ -8,7 +8,7 @@ describe('general attribute', () => { ...@@ -8,7 +8,7 @@ describe('general attribute', () => {
await page.waitFor('view') await page.waitFor('view')
}) })
it("class & style", async () => { it("class & style", async () => {
const image = await program.screenshot(); const image = await program.screenshot({fullPage: true});
expect(image).toSaveImageSnapshot(); expect(image).toSaveImageSnapshot();
}); });
it('validateGeneralAttributes', async () => { it('validateGeneralAttributes', async () => {
...@@ -21,7 +21,7 @@ describe('general attribute', () => { ...@@ -21,7 +21,7 @@ describe('general attribute', () => {
const button = await page.$(".btn-ref"); const button = await page.$(".btn-ref");
await button.tap(); await button.tap();
await page.waitFor(500); await page.waitFor(500);
const image = await program.screenshot(); const image = await program.screenshot({fullPage: true});
expect(image).toSaveImageSnapshot(); expect(image).toSaveImageSnapshot();
}); });
}) })
...@@ -20,7 +20,7 @@ describe('component-native-list-view', () => { ...@@ -20,7 +20,7 @@ describe('component-native-list-view', () => {
return await page.data('list_show') === true; return await page.data('list_show') === true;
}); });
await page.waitFor(200) await page.waitFor(200)
const image = await program.screenshot(); const image = await program.screenshot({fullPage: true});
expect(image).toSaveImageSnapshot(); expect(image).toSaveImageSnapshot();
}) })
...@@ -31,7 +31,7 @@ describe('component-native-list-view', () => { ...@@ -31,7 +31,7 @@ describe('component-native-list-view', () => {
return await page.data('displayArrow') === true; return await page.data('displayArrow') === true;
}); });
await page.waitFor(600) await page.waitFor(600)
const image = await program.screenshot(); const image = await program.screenshot({fullPage: true});
expect(image).toSaveImageSnapshot(); expect(image).toSaveImageSnapshot();
}) })
}) })
...@@ -18,7 +18,7 @@ describe('component-native-list-view-refresh', () => { ...@@ -18,7 +18,7 @@ describe('component-native-list-view-refresh', () => {
}); });
//等待下拉刷新结束 //等待下拉刷新结束
await page.waitFor(500) await page.waitFor(500)
const image = await program.screenshot(); const image = await program.screenshot({fullPage: true});
expect(image).toSaveImageSnapshot(); expect(image).toSaveImageSnapshot();
}) })
}) })
...@@ -17,7 +17,7 @@ describe('component-native-nested-scroll-body', () => { ...@@ -17,7 +17,7 @@ describe('component-native-nested-scroll-body', () => {
it('check_scroll_into_view_left', async () => { it('check_scroll_into_view_left', async () => {
await page.callMethod('testBodyScrollBy', 400) await page.callMethod('testBodyScrollBy', 400)
await page.waitFor(300) await page.waitFor(300)
const image = await program.screenshot(); const image = await program.screenshot({fullPage: true});
expect(image).toSaveImageSnapshot(); expect(image).toSaveImageSnapshot();
}) })
}) })
...@@ -15,7 +15,7 @@ describe('component-native-nested-scroll-header', () => { ...@@ -15,7 +15,7 @@ describe('component-native-nested-scroll-header', () => {
it('check_nested-scroll-header', async () => { it('check_nested-scroll-header', async () => {
const image = await program.screenshot(); const image = await program.screenshot({fullPage: true});
expect(image).toSaveImageSnapshot(); expect(image).toSaveImageSnapshot();
}) })
}) })
...@@ -89,7 +89,7 @@ describe('component-native-scroll-view-props', () => { ...@@ -89,7 +89,7 @@ describe('component-native-scroll-view-props', () => {
showScrollbar: false showScrollbar: false
}) })
await page.waitFor(300); await page.waitFor(300);
const image = await program.screenshot(); const image = await program.screenshot({fullPage: true});
expect(image).toSaveImageSnapshot(); expect(image).toSaveImageSnapshot();
}) })
......
...@@ -14,7 +14,7 @@ describe('component-native-scroll-view-refresher', () => { ...@@ -14,7 +14,7 @@ describe('component-native-scroll-view-refresher', () => {
showScrollbar: false showScrollbar: false
}) })
await page.waitFor(300); await page.waitFor(300);
const image = await program.screenshot(); const image = await program.screenshot({fullPage: true});
expect(image).toSaveImageSnapshot(); expect(image).toSaveImageSnapshot();
}) })
......
...@@ -12,7 +12,7 @@ describe('component-native-scroll-view', () => { ...@@ -12,7 +12,7 @@ describe('component-native-scroll-view', () => {
showScrollbar: false showScrollbar: false
}) })
await page.waitFor(300); await page.waitFor(300);
const image = await program.screenshot(); const image = await program.screenshot({fullPage: true});
expect(image).toSaveImageSnapshot(); expect(image).toSaveImageSnapshot();
}); });
}); });
...@@ -8,7 +8,7 @@ describe('component-native-sticky-header', () => { ...@@ -8,7 +8,7 @@ describe('component-native-sticky-header', () => {
//检测吸顶效果 //检测吸顶效果
it('check_sticky_header', async () => { it('check_sticky_header', async () => {
await page.callMethod('confirm_scroll_top_input', 600) await page.callMethod('confirm_scroll_top_input', 600)
const image = await program.screenshot(); const image = await program.screenshot({fullPage: true});
expect(image).toSaveImageSnapshot(); expect(image).toSaveImageSnapshot();
}) })
}) })
...@@ -8,7 +8,7 @@ describe('component-native-sticky-section', () => { ...@@ -8,7 +8,7 @@ describe('component-native-sticky-section', () => {
//检测吸顶上推效果 //检测吸顶上推效果
it('check_sticky_section', async () => { it('check_sticky_section', async () => {
await page.callMethod('listViewScrollByY', 1000) await page.callMethod('listViewScrollByY', 1000)
const image = await program.screenshot(); const image = await program.screenshot({fullPage: true});
expect(image).toSaveImageSnapshot(); expect(image).toSaveImageSnapshot();
}) })
...@@ -30,7 +30,7 @@ describe('component-native-sticky-section', () => { ...@@ -30,7 +30,7 @@ describe('component-native-sticky-section', () => {
await page.waitFor(async () => { await page.waitFor(async () => {
return await page.data('scrolling') === false; return await page.data('scrolling') === false;
}); });
const image = await program.screenshot(); const image = await program.screenshot({fullPage: true});
expect(image).toSaveImageSnapshot(); expect(image).toSaveImageSnapshot();
}) })
}) })
...@@ -29,15 +29,15 @@ describe('toSaveSnapshot & toSaveImageSnapshot template', () => { ...@@ -29,15 +29,15 @@ describe('toSaveSnapshot & toSaveImageSnapshot template', () => {
}) })
it('test toSaveImageSnapshot 1', async () => { it('test toSaveImageSnapshot 1', async () => {
const img1 = await program.screenshot(); const img1 = await program.screenshot({fullPage: true});
expect(img1).toSaveImageSnapshot() expect(img1).toSaveImageSnapshot()
const img2 = await program.screenshot(); const img2 = await program.screenshot({fullPage: true});
expect(img2).toSaveImageSnapshot() expect(img2).toSaveImageSnapshot()
}) })
it('test toSaveImageSnapshot 2', async () => { it('test toSaveImageSnapshot 2', async () => {
const img1 = await program.screenshot(); const img1 = await program.screenshot({fullPage: true});
expect(img1).toSaveImageSnapshot({ expect(img1).toSaveImageSnapshot({
customSnapshotsDir: './customDir/__image_snapshots__', customSnapshotsDir: './customDir/__image_snapshots__',
customSnapshotIdentifier() { customSnapshotIdentifier() {
...@@ -45,16 +45,16 @@ describe('toSaveSnapshot & toSaveImageSnapshot template', () => { ...@@ -45,16 +45,16 @@ describe('toSaveSnapshot & toSaveImageSnapshot template', () => {
}, },
}) })
const img2 = await program.screenshot(); const img2 = await program.screenshot({fullPage: true});
expect(img2).toSaveImageSnapshot({ expect(img2).toSaveImageSnapshot({
customSnapshotsDir: './customDir/__image_snapshots__', customSnapshotsDir: './customDir/__image_snapshots__',
}) })
const img3 = await program.screenshot(); const img3 = await program.screenshot({fullPage: true});
expect(img3).toSaveImageSnapshot({ expect(img3).toSaveImageSnapshot({
customSnapshotIdentifier() { customSnapshotIdentifier() {
return 'test-toSaveImageSnapshot-2-3'; return 'test-toSaveImageSnapshot-2-3';
}, },
}) })
}) })
}); });
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册