提交 c3125a87 编写于 作者: 杜庆泉's avatar 杜庆泉

swiper 自动化测试示例提交

上级 f5895c75
function getData(key = '') {
return new Promise(async (resolve, reject) => {
const data = await page.data()
resolve(key ? data[key] : data)
})
}
let page;
beforeAll(async () => {
page = await program.reLaunch('/pages/component/swiper/swiper')
await page.waitFor(600)
})
describe('test swiper', () => {
it('check indicator show', async () => {
await page.setData({
dotsSelect: true,
})
await page.waitFor(600)
await page.setData({
dotsSelect: false,
})
await page.waitFor(600)
/**
* todo 暂无判断条件
*/
});
it('check autoplay loop', async () => {
await page.setData({
autoplaySelect: true,
})
await page.waitFor(600)
expect(await getData('currentValChange')).toEqual(0)
await page.waitFor(2000)
expect(await getData('currentValChange')).toEqual(1)
await page.waitFor(5000)
expect(await getData('currentValChange')).toEqual(2)
await page.setData({
circularSelect: true
})
expect(await getData('currentValChange')).toEqual(2)
await page.waitFor(1000)
expect(await getData('currentValChange')).toEqual(0)
await page.setData({
circularSelect: false,
autoplaySelect: false
})
});
it('check loop index', async () => {
await page.setData({
currentVal: 2,
})
await page.waitFor(1600)
expect(await getData('currentValChange')).toEqual(2)
await page.setData({
currentVal: 0,
})
await page.waitFor(1600)
expect(await getData('currentValChange')).toEqual(0)
});
});
......@@ -86,7 +86,6 @@
data() {
return {
background: ['color1', 'color2', 'color3'],
interval: 2000,
dotsSelect: false,
reboundSelect:false,
autoplaySelect: false,
......@@ -95,7 +94,7 @@
verticalSelect: false,
currentSelect: false,
currentItemIdSelect: false,
intervalSelect: 1000,
intervalSelect: 2000,
indicatorColor: "",
indicatorColorActive: "",
currentVal: 0,
......@@ -103,12 +102,14 @@
disableTouchSelect: false,
swiperTransitionSelect: false,
swiperAnimationfinishSelect: false,
swiperChangeSelect: false
swiperChangeSelect: false,
currentValChange:0
}
},
methods: {
},
swiperChange: function (e : SwiperChangeEvent) {
methods: {
swiperChange: function (e : SwiperChangeEvent) {
this.currentValChange = e.detail.current
if (this.swiperChangeSelect) {
console.log("swiperChange")
console.log(e)
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册