提交 0afece61 编写于 作者: Anne_LXM's avatar Anne_LXM

test(swiper): 支持 iOS 端测试

上级 fda74e16
jest.setTimeout(30000); jest.setTimeout(30000);
describe('test swiper', () => { 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; let page;
const webDetailRes = { const webDetailRes = {
current: 1, current: 1,
...@@ -91,19 +81,23 @@ describe('test swiper', () => { ...@@ -91,19 +81,23 @@ describe('test swiper', () => {
autoplaySelect:true autoplaySelect:true
}) })
await page.waitFor(2000) await page.waitFor(2000)
if(await page.data('currentValChange') == 1){ await page.waitFor(async()=>{
await page.setData({ return await page.data('currentValChange') == 1
autoplaySelect:false })
}) await page.setData({
} autoplaySelect:false
})
}); });
it('Event transitiont', async () => { it('Event transitiont', async () => {
// android端swiper的事件event参数detail类型错误,暂时忽略测试 // bug:android端swiper的事件event参数detail类型错误,暂时忽略测试
if(!process.env.UNI_UTS_PLATFORM.startsWith('app-android')){ if(!process.env.UNI_UTS_PLATFORM.startsWith('app-android')){
const transitionDetailInfo = await page.data('transitionDetailTest') const transitionDetailInfo = await page.data('transitionDetailTest')
expect(transitionDetailInfo.dy).toBe(0) // bug:在iOS端,swiper首次横向滑动切换@transition事件参数e.detail.dy为1错误,暂时忽略测试
expect(transitionDetailInfo.dx).toBeGreaterThan(0) 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') expect(await page.data('isTransitionTest')).toBe('transition:Pass')
} }
}); });
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册