From 55acad322340b56877846dd143f4f106939aca91 Mon Sep 17 00:00:00 2001 From: Anne_LXM Date: Thu, 20 Jun 2024 14:56:25 +0800 Subject: [PATCH] =?UTF-8?q?test(swiper):=20=E4=BF=AE=E5=A4=8D=E7=B1=BB?= =?UTF-8?q?=E5=9E=8B=E6=8A=A5=E9=94=99/=E6=94=BE=E5=BC=80android=20?= =?UTF-8?q?=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/swiper/swiper.test.js | 29 +++++++++++---------------- pages/component/swiper/swiper.uvue | 15 +++----------- 2 files changed, 15 insertions(+), 29 deletions(-) diff --git a/pages/component/swiper/swiper.test.js b/pages/component/swiper/swiper.test.js index 07bec724..47e9b9c7 100644 --- a/pages/component/swiper/swiper.test.js +++ b/pages/component/swiper/swiper.test.js @@ -90,28 +90,23 @@ describe('test swiper', () => { }); it('Event transitiont', async () => { - // bug:android端swiper的事件event参数detail类型错误,暂时忽略测试 - if(!process.env.UNI_UTS_PLATFORM.startsWith('app-android')){ - const transitionDetailInfo = await page.data('transitionDetailTest') - // bug:在iOS端,swiper首次横向滑动切换@transition事件参数e.detail.dy为1错误,暂时忽略测试 - if(process.env.uniTestPlatformInfo.startsWith('web')){ - expect(transitionDetailInfo.dy).toBe(0) - } - expect(transitionDetailInfo.dx).not.toBe(0) - expect(await page.data('isTransitionTest')).toBe('transition:Success') + const transitionDetailInfo = await page.data('transitionDetailTest') + // bug:在iOS端,swiper首次横向滑动切换@transition事件参数e.detail.dy为1错误,暂时忽略测试 + if(process.env.uniTestPlatformInfo.startsWith('web')){ + expect(transitionDetailInfo.dy).toBe(0) } + expect(transitionDetailInfo.dx).not.toBe(0) + expect(await page.data('isTransitionTest')).toBe('transition:Success') }); it('Event change', async () => { - if(!process.env.UNI_UTS_PLATFORM.startsWith('app-android')){ - const changeDetailInfo = await page.data('changeDetailTest') - if(process.env.uniTestPlatformInfo.startsWith('web')){ - expect(changeDetailInfo).toEqual(webDetailRes) - }else{ - expect(changeDetailInfo).toEqual(appDetailRes) - } - expect(await page.data('isChangeTest')).toBe('change:Success') + const changeDetailInfo = await page.data('changeDetailTest') + if(process.env.uniTestPlatformInfo.startsWith('web')){ + expect(changeDetailInfo).toEqual(webDetailRes) + }else{ + expect(changeDetailInfo).toEqual(appDetailRes) } + expect(await page.data('isChangeTest')).toBe('change:Success') }); it('Event animationfinish', async () => { diff --git a/pages/component/swiper/swiper.uvue b/pages/component/swiper/swiper.uvue index b879b77a..98267b05 100644 --- a/pages/component/swiper/swiper.uvue +++ b/pages/component/swiper/swiper.uvue @@ -117,12 +117,9 @@ swiperChangeSelect: false, currentValChange: 0, // 自动化测试 - // 在android端以下事件event参数中detail类型报错,先条件编译处理 - // #ifndef APP-ANDROID - changeDetailTest:null as UniSwiperChangeDetail | null, - transitionDetailTest:null as UniSwiperTransitionDetail | null, - animationfinishDetailTest:null as UniSwiperAnimationFinishDetail | null, - // #endif + changeDetailTest:null as UniSwiperChangeEventDetail | null, + transitionDetailTest:null as UniSwiperTransitionEventDetail | null, + animationfinishDetailTest:null as UniSwiperAnimationFinishEventDetail | null, isChangeTest:'', isTransitionTest:'', isAnimationfinishTest:'' @@ -130,9 +127,7 @@ }, methods: { swiperChange: function (e : UniSwiperChangeEvent) { - // #ifndef APP-ANDROID this.changeDetailTest = e.detail - // #endif this.checkEventTest({ type:e.type, target:e.target, @@ -146,9 +141,7 @@ } }, swiperTransition: function (e : UniSwiperTransitionEvent) { - // #ifndef APP-ANDROID this.transitionDetailTest = e.detail - // #endif this.checkEventTest({ type:e.type, target:e.target, @@ -160,9 +153,7 @@ } }, swiperAnimationfinish: function (e : UniSwiperAnimationFinishEvent) { - // #ifndef APP-ANDROID this.animationfinishDetailTest = e.detail - // #endif this.checkEventTest({ type:e.type, target:e.target, -- GitLab