提交 a47ac027 编写于 作者: DCloud-WZF's avatar DCloud-WZF 💬

test: 优化 swiper 测试

上级 5e7efe0e
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()
...@@ -13,8 +15,6 @@ beforeAll(async () => { ...@@ -13,8 +15,6 @@ beforeAll(async () => {
describe('test swiper', () => { describe('test swiper', () => {
it('check indicator show', async () => { it('check indicator show', async () => {
await page.setData({ await page.setData({
dotsSelect: true, dotsSelect: true,
...@@ -32,22 +32,28 @@ describe('test swiper', () => { ...@@ -32,22 +32,28 @@ describe('test swiper', () => {
it('check autoplay loop', async () => { it('check autoplay loop', async () => {
await page.setData({ await page.setData({
autoplaySelect: true, autoplaySelect: true,
currentValChange:0, currentValChange: 0,
}) })
await page.waitFor(600) await page.waitFor(600)
expect(await getData('currentValChange')).toEqual(0) expect(await getData('currentValChange')).toEqual(0)
await page.waitFor(2000) await page.waitFor(1600)
expect(await getData('currentValChange')).toEqual(1) expect(await getData('currentValChange')).toEqual(1)
await page.waitFor(4000) await page.waitFor(2000)
expect(await getData('currentValChange')).toEqual(2)
await page.waitFor(2000)
expect(await getData('currentValChange')).toEqual(0) expect(await getData('currentValChange')).toEqual(0)
await page.setData({ await page.setData({
circularSelect: true, circularSelect: true,
currentValChange:0, currentValChange: 0,
}) })
await page.waitFor(2000) await page.waitFor(600)
expect(await getData('currentValChange')).toEqual(0)
await page.waitFor(1600)
expect(await getData('currentValChange')).toEqual(1) expect(await getData('currentValChange')).toEqual(1)
await page.waitFor(2000) await page.waitFor(2000)
expect(await getData('currentValChange')).toEqual(2) expect(await getData('currentValChange')).toEqual(2)
await page.waitFor(2000)
expect(await getData('currentValChange')).toEqual(0)
await page.setData({ await page.setData({
circularSelect: false, circularSelect: false,
autoplaySelect: false autoplaySelect: false
...@@ -75,6 +81,7 @@ describe('test swiper', () => { ...@@ -75,6 +81,7 @@ describe('test swiper', () => {
}) })
await page.waitFor(600) await page.waitFor(600)
expect(await getData('currentValChange')).toEqual(2) expect(await getData('currentValChange')).toEqual(2)
await page.setData({ await page.setData({
currentItemIdVal: 'A', currentItemIdVal: 'A',
}) })
...@@ -83,4 +90,3 @@ describe('test swiper', () => { ...@@ -83,4 +90,3 @@ describe('test swiper', () => {
}); });
}); });
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册