diff --git a/pages/component/swiper/swiper.test.js b/pages/component/swiper/swiper.test.js index ae63884af675e1333212ef7b7b74ace11ae7ec20..c26669f1d0fcc562a1140a7b0cf773bdd84683ce 100644 --- a/pages/component/swiper/swiper.test.js +++ b/pages/component/swiper/swiper.test.js @@ -1,15 +1,5 @@ jest.setTimeout(30000); - describe('test swiper', () => { - const platformInfo = process.env.uniTestPlatformInfo.toLocaleLowerCase() - const isIos = platformInfo.startsWith('ios') - if (isIos) { - it('dummyTest', () => { - expect(1).toBe(1) - }) - return - } - let page; const webDetailRes = { current: 1, @@ -91,19 +81,23 @@ describe('test swiper', () => { autoplaySelect:true }) await page.waitFor(2000) - if(await page.data('currentValChange') == 1){ - await page.setData({ - autoplaySelect:false - }) - } + await page.waitFor(async()=>{ + return await page.data('currentValChange') == 1 + }) + await page.setData({ + autoplaySelect:false + }) }); it('Event transitiont', async () => { - // android端swiper的事件event参数detail类型错误,暂时忽略测试 + // bug:android端swiper的事件event参数detail类型错误,暂时忽略测试 if(!process.env.UNI_UTS_PLATFORM.startsWith('app-android')){ const transitionDetailInfo = await page.data('transitionDetailTest') - expect(transitionDetailInfo.dy).toBe(0) - expect(transitionDetailInfo.dx).toBeGreaterThan(0) + // 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:Pass') } });