From 2774843b09ec2db4c86f5cb39eed0af70a5e9998 Mon Sep 17 00:00:00 2001 From: yinjiacheng Date: Thu, 7 Dec 2023 16:08:46 +0800 Subject: [PATCH] =?UTF-8?q?=E6=9B=B4=E6=96=B0=E9=A1=B5=E9=9D=A2=E6=88=AA?= =?UTF-8?q?=E5=9B=BE=E8=87=AA=E5=8A=A8=E5=8C=96=E6=B5=8B=E8=AF=95=E7=94=A8?= =?UTF-8?q?=E4=BE=8B?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- pages/pages.test.js | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/pages/pages.test.js b/pages/pages.test.js index 8a85d605..26e425b1 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); }); -- GitLab