diff --git a/pages/component/scroll-view/scroll-view-refresher.test.js b/pages/component/scroll-view/scroll-view-refresher.test.js index 92315f79d944bf7cc73aaaf504b44762ead8cd25..3fdd958e82e518c754953d1458719b04206d73ce 100644 --- a/pages/component/scroll-view/scroll-view-refresher.test.js +++ b/pages/component/scroll-view/scroll-view-refresher.test.js @@ -12,14 +12,6 @@ describe('component-native-scroll-view-refresher', () => { page = await program.reLaunch('/pages/component/scroll-view/scroll-view-refresher'); await page.waitFor(300); }); - - async function eventCheck(dataName,typeName){ - const eventInfo = await page.data(dataName) - expect(eventInfo.type).toBe(typeName) - expect(eventInfo.currentTarget).not.toBeFalsy(); - expect(eventInfo.target).not.toBeFalsy(); - expect(eventInfo.detail.dy).toBeGreaterThan(0) - } it('scroll-view-refresher-screenshot', async () => { //禁止滚动条 @@ -39,12 +31,25 @@ describe('component-native-scroll-view-refresher', () => { expect(await page.data('refresherrefreshTimes')).toBe(1) // 手动设置下拉刷新状态refresher-triggered为true时,在web和iOS不触发@refresherpulling事件 if(process.env.uniTestPlatformInfo.startsWith('android')){ - await eventCheck('onRefresherpullingTest','refresherpulling') + expect(await page.data('onRefresherpullingTest')).toBe('refresherpulling:Success') } - await eventCheck('refresherrefreshTest','refresherrefresh') + expect(await page.data('refresherrefreshTest')).toBe('refresherrefresh:Success') await page.waitFor(1000); - await eventCheck('onRefresherrestoreTest','refresherrestore') + expect(await page.data('onRefresherrestoreTest')).toBe('refresherrestore:Success') }); + + // 仅App端支持手势下拉刷新 + if(!process.env.uniTestPlatformInfo.startsWith('web')){ + it('check_refresherabort', async () => { + await program.swipe({ + startPoint: {x: 100,y: 500}, + endPoint: {x: 100,y: 630}, + duration: 1000 + }) + await page.waitFor(1500) + expect(await page.data('onRefresherabortTest')).toBe('refresherabort:Success') + }); + } it('check_refresher_snapshot', async () => { await page.setData({ diff --git a/pages/component/scroll-view/scroll-view-refresher.uvue b/pages/component/scroll-view/scroll-view-refresher.uvue index 773103d95d4a1ce91d85369bd45985d273705432..ddd5611a5ece7e0105436ff84104f960410e7b4d 100644 --- a/pages/component/scroll-view/scroll-view-refresher.uvue +++ b/pages/component/scroll-view/scroll-view-refresher.uvue @@ -13,6 +13,12 @@ diff --git a/pages/component/swiper/swiper.test.js b/pages/component/swiper/swiper.test.js index c26669f1d0fcc562a1140a7b0cf773bdd84683ce..07bec724a02dfb9464115646ed58b8ff69b85481 100644 --- a/pages/component/swiper/swiper.test.js +++ b/pages/component/swiper/swiper.test.js @@ -98,7 +98,7 @@ describe('test swiper', () => { expect(transitionDetailInfo.dy).toBe(0) } expect(transitionDetailInfo.dx).not.toBe(0) - expect(await page.data('isTransitionTest')).toBe('transition:Pass') + expect(await page.data('isTransitionTest')).toBe('transition:Success') } }); @@ -110,7 +110,7 @@ describe('test swiper', () => { }else{ expect(changeDetailInfo).toEqual(appDetailRes) } - expect(await page.data('isChangeTest')).toBe('change:Pass') + expect(await page.data('isChangeTest')).toBe('change:Success') } }); @@ -124,7 +124,7 @@ describe('test swiper', () => { }else{ expect(animationfinishDetailInfo).toEqual(appDetailRes) } - expect(await page.data('isAnimationfinishTest')).toBe('animationfinish:Pass') + expect(await page.data('isAnimationfinishTest')).toBe('animationfinish:Success') } }); }); diff --git a/pages/component/swiper/swiper.uvue b/pages/component/swiper/swiper.uvue index 9dc552087742bf04b688881cb8f1c6f08f497cab..b879b77a8061a5ea98c175883f9e7bac11ad5b4e 100644 --- a/pages/component/swiper/swiper.uvue +++ b/pages/component/swiper/swiper.uvue @@ -129,24 +129,6 @@ } }, methods: { - // 自动化测试专用(由于事件event参数对象中存在循环引用,在ios端JSON.stringify报错,自动化测试无法page.data获取) - checkEventTest(e:SwiperEventTest, eventName:String){ - const isPass = e.type === eventName && e.target instanceof UniElement && e.currentTarget instanceof UniElement; - const result = isPass ? `${eventName}:Pass` : `${eventName}:NoPass`; - switch (eventName){ - case 'change': - this.isChangeTest = result - break; - case 'transition': - this.isTransitionTest = result - break; - case 'animationfinish': - this.isAnimationfinishTest = result - break; - default: - break; - } - }, swiperChange: function (e : UniSwiperChangeEvent) { // #ifndef APP-ANDROID this.changeDetailTest = e.detail @@ -191,7 +173,24 @@ console.log(e) } }, - + // 自动化测试专用(由于事件event参数对象中存在循环引用,在ios端JSON.stringify报错,自动化测试无法page.data获取) + checkEventTest(e:SwiperEventTest, eventName:String){ + const isPass = e.type === eventName && e.target instanceof UniElement && e.currentTarget instanceof UniElement; + const result = isPass ? `${eventName}:Success` : `${eventName}:Fail`; + switch (eventName){ + case 'change': + this.isChangeTest = result + break; + case 'transition': + this.isTransitionTest = result + break; + case 'animationfinish': + this.isAnimationfinishTest = result + break; + default: + break; + } + }, dotsChange: function (e : UniSwitchChangeEvent) { this.dotsSelect = e.detail.value },