From 1feeaafa7dfc76d1b7ff5b1b9ec52497da89cf6a Mon Sep 17 00:00:00 2001 From: shutao Date: Fri, 6 Dec 2024 12:00:06 +0800 Subject: [PATCH] =?UTF-8?q?=E6=9B=B4=E6=96=B0=E8=87=AA=E5=8A=A8=E5=8C=96?= =?UTF-8?q?=E6=B5=8B=E8=AF=95=E6=A0=A1=E9=AA=8Candroid=E6=BB=9A=E5=8A=A8?= =?UTF-8?q?=E8=B7=9D=E7=A6=BB=E5=B0=8F=E6=95=B0=E7=9A=84=E5=88=A4=E6=96=AD?= =?UTF-8?q?=E9=80=BB=E8=BE=91?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- pages/component/list-view/list-view.test.js | 10 ++++++---- pages/component/scroll-view/scroll-view.test.js | 15 +++++++++------ pages/component/waterflow/waterflow.test.js | 10 ++++++---- 3 files changed, 21 insertions(+), 14 deletions(-) diff --git a/pages/component/list-view/list-view.test.js b/pages/component/list-view/list-view.test.js index 42f29be5..28c60cb7 100644 --- a/pages/component/list-view/list-view.test.js +++ b/pages/component/list-view/list-view.test.js @@ -51,13 +51,15 @@ describe('component-native-list-view', () => { const scrollDetail = await page.data('scrollDetailTest') // console.log('scrollDetailTest:', scrollDetail) expect(scrollDetail.scrollLeft).toBe(0) - // scrollTop和deltaY 在安卓端差异 299.8095 - expect([300, 299.8095]).toContain(scrollDetail.scrollTop); + // scrollTop和deltaY 在安卓端差异 299.8095 + expect(scrollDetail.scrollTop).toBeGreaterThan(299.5) + //expect([300, 299.8095]).toContain(scrollDetail.scrollTop); expect(scrollDetail.scrollHeight).toBeGreaterThan(0) expect(scrollDetail.scrollWidth).toBeGreaterThan(0) expect(scrollDetail.deltaX).toBe(0) - //此处可判断安卓issues:9121的问题 - expect([300.1905, 300, 299.8095]).toContain(scrollDetail.deltaY); + //此处可判断安卓issues:9121的问题 + expect(scrollDetail.deltaY).toBeGreaterThan(299.5) + //expect([300.1905, 300, 299.8095]).toContain(scrollDetail.deltaY); expect(await page.data('isScrollTest')).toBe('scroll:Success') }) diff --git a/pages/component/scroll-view/scroll-view.test.js b/pages/component/scroll-view/scroll-view.test.js index a7b90d21..a7b14bc3 100644 --- a/pages/component/scroll-view/scroll-view.test.js +++ b/pages/component/scroll-view/scroll-view.test.js @@ -19,8 +19,9 @@ describe('component-native-scroll-view', () => { const topScrollDetail = await page.data('scrollDetailTest') console.log('topScrollDetail:', topScrollDetail) expect(topScrollDetail.scrollLeft).toBe(0) - // Android 差异scrollTop:99.809525 - expect([100, 99.809525]).toContain(topScrollDetail.scrollTop); + // Android 差异scrollTop:99.809525 + expect(topScrollDetail.scrollTop).toBeGreaterThan(99.5) + //expect([100, 99.809525]).toContain(topScrollDetail.scrollTop); expect(topScrollDetail.scrollHeight).toBeGreaterThan(0) expect(topScrollDetail.scrollWidth).toBeGreaterThan(0) expect(topScrollDetail.deltaX).toBe(0) @@ -35,13 +36,15 @@ describe('component-native-scroll-view', () => { //设置left 是否触发scroll 事件 const leftScrollDetail = await page.data('scrollDetailTest') console.log('leftScrollDetail:', leftScrollDetail) - // Android 差异scrollLeft:219.80952 - expect([220, 219.80952]).toContain(leftScrollDetail.scrollLeft); + // Android 差异scrollLeft:219.80952 + expect(leftScrollDetail.scrollLeft).toBeGreaterThan(219.5) + //expect([220, 219.80952]).toContain(leftScrollDetail.scrollLeft); expect(leftScrollDetail.scrollTop).toBe(0) expect(leftScrollDetail.scrollHeight).toBeGreaterThan(0) expect(leftScrollDetail.scrollWidth).toBeGreaterThan(0) - // 在安卓差异 -99.809525 - expect([-100, -99.809525]).toContain(leftScrollDetail.deltaX); + // 在安卓差异 -99.809525 + expect(leftScrollDetail.deltaX).toBeLessThan(-99.5) + //expect([-100, -99.809525]).toContain(leftScrollDetail.deltaX); expect(leftScrollDetail.deltaY).toBe(0) expect(await page.data('isScrollTest')).toBe('scroll:Success') }) diff --git a/pages/component/waterflow/waterflow.test.js b/pages/component/waterflow/waterflow.test.js index 432f4442..7bea611d 100644 --- a/pages/component/waterflow/waterflow.test.js +++ b/pages/component/waterflow/waterflow.test.js @@ -32,13 +32,15 @@ describe('component-native-waterflow', () => { const scrollDetail = await page.data('scrollDetailTest') // console.log('scrollDetailTest:', scrollDetail) expect(scrollDetail.scrollLeft).toBe(0) - // scrollTop和deltaY 在安卓端差异 299.8095 - expect([300, 299.8095]).toContain(scrollDetail.scrollTop); + // scrollTop和deltaY 在安卓端差异 299.8095 + expect(scrollDetail.scrollTop).toBeGreaterThan(299.5) + //expect([300, 299.8095]).toContain(scrollDetail.scrollTop); expect(scrollDetail.scrollHeight).toBeGreaterThan(0) expect(scrollDetail.scrollWidth).toBeGreaterThan(0) expect(scrollDetail.deltaX).toBe(0) - //此处可判断安卓issues:9121的问题 - expect([300.1905, 300, 299.8095]).toContain(scrollDetail.deltaY); + //此处可判断安卓issues:9121的问题 + expect(scrollDetail.deltaY).toBeGreaterThan(299.5) + //expect([300.1905, 300, 299.8095]).toContain(scrollDetail.deltaY); expect(await page.data('isScrollTest')).toBe('scroll:Success') }) -- GitLab