From 5ba01433f5f70d9b151e3942a1e226fdd858460e Mon Sep 17 00:00:00 2001 From: Anne_LXM Date: Thu, 22 Aug 2024 15:08:39 +0800 Subject: [PATCH] =?UTF-8?q?test(scroll-view.test.js):=20=E8=B0=83=E6=95=B4?= =?UTF-8?q?=E6=B5=8B=E8=AF=95=E7=94=A8=E4=BE=8B=E9=A1=BA=E5=BA=8F=EF=BC=8C?= =?UTF-8?q?=E9=81=BF=E5=85=8D=E6=A8=AA=E5=90=91=E6=BB=9A=E5=8A=A8deltaX?= =?UTF-8?q?=E5=8F=97=E5=BD=B1=E5=93=8D?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../component/scroll-view/scroll-view.test.js | 28 +++++++++---------- 1 file changed, 13 insertions(+), 15 deletions(-) diff --git a/pages/component/scroll-view/scroll-view.test.js b/pages/component/scroll-view/scroll-view.test.js index b3c01829..c5afbf8a 100644 --- a/pages/component/scroll-view/scroll-view.test.js +++ b/pages/component/scroll-view/scroll-view.test.js @@ -3,17 +3,7 @@ describe('component-native-scroll-view', () => { let page; beforeAll(async () => { page = await program.reLaunch('/pages/component/scroll-view/scroll-view'); - await page.waitFor(300); - }); - - it('scroll-view-screenshot', async () => { - //禁止滚动条 - await page.setData({ - showScrollbar: false - }) - await page.waitFor(300); - const image = await program.screenshot({fullPage: true}); - expect(image).toSaveImageSnapshot(); + await page.waitFor("view"); }); it('Event scroll-vertical',async()=>{ @@ -34,12 +24,9 @@ describe('component-native-scroll-view', () => { }) it('Event scroll-horizontal',async()=>{ - console.log('data-1:', await page.data()) // 横向滚动 await page.setData({scrollLeft:220}) - const waitTime = process.env.uniTestPlatformInfo.includes('chrome') ? 4000:1000 - await page.waitFor(waitTime) - console.log('data-2:', await page.data()) + await page.waitFor(1000) //设置left 是否触发scroll 事件 const leftScrollDetail = await page.data('scrollDetailTest') console.log('leftScrollDetail:', leftScrollDetail) @@ -54,6 +41,17 @@ describe('component-native-scroll-view', () => { expect(await page.data('isScrollTest')).toBe('scroll:Success') }) + // 移后:此测试用例在某些mac-chrome会影响scroll-horizontal的deltaX结果 + it('scroll-view-screenshot', async () => { + //禁止滚动条 + await page.setData({ + showScrollbar: false + }) + await page.waitFor(300); + const image = await program.screenshot({fullPage: true}); + expect(image).toSaveImageSnapshot(); + }); + it('Event scrolltolower-滚动到底部/右边',async()=>{ // 滚动到底部scrollTop:300,是否触发scrolltolower事件 await page.setData({scrollTop: 300}) -- GitLab