diff --git a/pages/pages.test.js b/pages/pages.test.js index 8a85d605f3e9110b424c52c7e6a53fd1585543c8..26e425b1fb3f02f709ed89970e14f2605c1cf8a1 100755 --- a/pages/pages.test.js +++ b/pages/pages.test.js @@ -135,6 +135,12 @@ if (process.env.uniTestPlatformInfo.startsWith('android')) { ) } +// 设置position: fixed的页面不能截取完整内容 +const notFullPages = [ + '/pages/CSS/layout/position', + '/pages/CSS/layout/z-index' +] + let page; describe("page screenshot test", () => { beforeAll(async () => { @@ -152,9 +158,13 @@ describe("page screenshot test", () => { }); test.each(pages)("%s", async () => { console.log("Taking screenshot: ", pageIndex, pages[pageIndex]); + let fullPage = true; + if (notFullPages.includes(pages[pageIndex])) { + fullPage = false; + } const image = await program.screenshot({ - fullPage: true, - }); + fullPage: fullPage + }); expect(image).toMatchImageSnapshot(); await page.waitFor(500); });