From 673ea56cea37a2990cf1e3daccbb4a2bbf13a1ae Mon Sep 17 00:00:00 2001 From: Anne_LXM Date: Thu, 13 Jun 2024 17:58:18 +0800 Subject: [PATCH] =?UTF-8?q?test(list-view):=20=E8=B0=83=E6=95=B4=E5=85=BC?= =?UTF-8?q?=E5=AE=B9=20iOS=20=E7=AB=AF=E6=B5=8B=E8=AF=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- pages/component/list-view/list-view-refresh.test.js | 8 ++++---- pages/component/list-view/list-view.test.js | 8 +++++--- pages/component/scroll-view/scroll-view.test.js | 3 +++ 3 files changed, 12 insertions(+), 7 deletions(-) diff --git a/pages/component/list-view/list-view-refresh.test.js b/pages/component/list-view/list-view-refresh.test.js index 05c30fcf..0cd2971e 100644 --- a/pages/component/list-view/list-view-refresh.test.js +++ b/pages/component/list-view/list-view-refresh.test.js @@ -20,13 +20,13 @@ describe('component-native-list-view-refresh', () => { await page.waitFor(500) const image = await program.screenshot({fullPage: true}); expect(image).toSaveImageSnapshot(); - // 手动设置下拉刷新状态refresher-triggered为true时,在iOS不触发@refresherpulling事件 + // 手动设置下拉刷新状态refresher-triggered为true时,在iOS不触发@refresherpulling事件,并且e.detail.dy为0 if(process.env.UNI_UTS_PLATFORM.startsWith('app-android')){ expect(await page.data('onRefresherpullingTest')).toBe('refresherpulling:Success') + expect(await page.data('refresherrefreshTest')).toBe('refresherrefresh:Success') + await page.waitFor(1000); + expect(await page.data('onRefresherrestoreTest')).toBe('refresherrestore:Success') } - expect(await page.data('refresherrefreshTest')).toBe('refresherrefresh:Success') - await page.waitFor(1000); - expect(await page.data('onRefresherrestoreTest')).toBe('refresherrestore:Success') }) it('check_refresherabort', async () => { diff --git a/pages/component/list-view/list-view.test.js b/pages/component/list-view/list-view.test.js index cd44ef19..57787f3e 100644 --- a/pages/component/list-view/list-view.test.js +++ b/pages/component/list-view/list-view.test.js @@ -41,6 +41,7 @@ describe('component-native-list-view', () => { // 在web端scroll事件event参数中detail类型报错,先忽略测试 if(!process.env.UNI_UTS_PLATFORM.startsWith('web')){ const scrollDetail = await page.data('scrollDetailTest') + console.log('scrollDetailTest:', scrollDetail) expect(scrollDetail.scrollLeft).toBe(0) expect(scrollDetail.scrollTop).toBe(300) expect(scrollDetail.scrollHeight).toBeGreaterThan(0) @@ -73,14 +74,15 @@ describe('component-native-list-view', () => { } it('Event scrollend-滚动结束时触发',async()=>{ - // 仅App端支持,向下滑动页面 + // 仅App端支持,向上滑动页面 await program.swipe({ - startPoint: { x: 100, y: 500 }, - endPoint: { x: 100, y: 200 }, + startPoint: { x: 100, y: 300 }, + endPoint: { x: 100, y: 100 }, duration: 1000 }) await page.waitFor(600) const endDetail = await page.data('scrollEndDetailTest') + console.log('scrollEndDetailTest:', endDetail) expect(endDetail.deltaY).toBe(0) expect(endDetail.deltaX).toBe(0) expect(endDetail.scrollLeft).toBe(0) diff --git a/pages/component/scroll-view/scroll-view.test.js b/pages/component/scroll-view/scroll-view.test.js index f2b82ea8..bdd133b2 100644 --- a/pages/component/scroll-view/scroll-view.test.js +++ b/pages/component/scroll-view/scroll-view.test.js @@ -24,6 +24,7 @@ describe('component-native-scroll-view', () => { if(!process.env.UNI_UTS_PLATFORM.startsWith('web')){ // 设置top 是否触发scroll 事件 const topScrollDetail = await page.data('scrollDetailTest') + console.log('topScrollDetail:', topScrollDetail) expect(topScrollDetail.scrollLeft).toBe(0) // Android 差异scrollTop:99.809525 if(!process.env.uniTestPlatformInfo.startsWith('android')){ @@ -44,6 +45,7 @@ describe('component-native-scroll-view', () => { if(!process.env.UNI_UTS_PLATFORM.startsWith('web')){ //设置left 是否触发scroll 事件 const leftScrollDetail = await page.data('scrollDetailTest') + console.log('leftScrollDetail:', leftScrollDetail) // Android 差异scrollLeft:219.80952 if(!process.env.uniTestPlatformInfo.startsWith('android')){ expect(leftScrollDetail.scrollLeft).toBe(220) @@ -75,6 +77,7 @@ describe('component-native-scroll-view', () => { if(!process.env.UNI_UTS_PLATFORM.startsWith('web')){ it('Event scrollend-滚动结束时触发仅App端支持',async()=>{ const endDetail = await page.data('scrollEndDetailTest') + console.log('scrollEndDetailTest:', endDetail) expect(endDetail.scrollLeft).toBe(0) expect(endDetail.scrollTop).toBe(0) expect(endDetail.deltaY).toBe(0) -- GitLab