提交 b36d493b 编写于 作者: DCloud_iOS_WZT's avatar DCloud_iOS_WZT

更新 Swiper测试用例

上级 082ca144
jest.setTimeout(20000); jest.setTimeout(20000);
function getData(key = '') { function getData(key = '') {
return new Promise(async (resolve, reject) => { return new Promise(async (resolve, reject) => {
const data = await page.data() const data = await page.data()
...@@ -30,35 +30,38 @@ describe('test swiper', () => { ...@@ -30,35 +30,38 @@ describe('test swiper', () => {
}); });
it('check autoplay loop', async () => { it('check autoplay loop', async () => {
await page.setData({ // iOS平台此测试用例 等待时长不准确 导致用例过不了
autoplaySelect: true, if (!process.env.uniTestPlatformInfo.startsWith('IOS_SIMULATOR')) {
currentValChange: 0, await page.setData({
}) autoplaySelect: true,
await page.waitFor(600) currentValChange: 0,
expect(await getData('currentValChange')).toEqual(0) })
await page.waitFor(1600) await page.waitFor(600)
expect(await getData('currentValChange')).toEqual(1) expect(await getData('currentValChange')).toEqual(0)
await page.waitFor(2000) await page.waitFor(1800)
expect(await getData('currentValChange')).toEqual(2) expect(await getData('currentValChange')).toEqual(1)
await page.waitFor(2000) await page.waitFor(2000)
expect(await getData('currentValChange')).toEqual(0) expect(await getData('currentValChange')).toEqual(2)
await page.setData({ await page.waitFor(2000)
circularSelect: true, expect(await getData('currentValChange')).toEqual(0)
currentValChange: 0, await page.setData({
}) circularSelect: true,
await page.waitFor(600) currentValChange: 0,
expect(await getData('currentValChange')).toEqual(0) })
await page.waitFor(1600) await page.waitFor(600)
expect(await getData('currentValChange')).toEqual(1) expect(await getData('currentValChange')).toEqual(0)
await page.waitFor(2000) await page.waitFor(1800)
expect(await getData('currentValChange')).toEqual(2) expect(await getData('currentValChange')).toEqual(1)
await page.waitFor(2000) await page.waitFor(1800)
expect(await getData('currentValChange')).toEqual(0) expect(await getData('currentValChange')).toEqual(2)
await page.setData({ await page.waitFor(1800)
circularSelect: false, expect(await getData('currentValChange')).toEqual(0)
autoplaySelect: false await page.setData({
}) circularSelect: false,
await page.waitFor(300) autoplaySelect: false
})
await page.waitFor(300)
}
}); });
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册