提交 41c6bf75 编写于 作者: DCloud_iOS_XHY's avatar DCloud_iOS_XHY

增加 swiper 模拟滑动自动化测试例

上级 539caa69
......@@ -9,9 +9,9 @@
:rebound="reboundSelect" :interval="intervalSelect" :circular="circularSelect"
:indicator-color="indicatorColor" :indicator-active-color="indicatorColorActive"
:disable-touch="disableTouchSelect" :current="currentVal" :current-item-id="currentItemIdVal"
@change="swiperChange" @transition="swiperTransition" @animationfinish="swiperAnimationfinish">
@change="swiperChange" @transition="swiperTransition" @animationfinish="swiperAnimationfinish" @touchstart="swipertouchStart">
<swiper-item item-id="A">
<view class="swiper-item uni-bg-red"><text class="swiper-item-Text">A</text></view>
<view class="swiper-item uni-bg-red"><text class="swiper-item-Text" >A</text></view>
</swiper-item>
<swiper-item item-id="B">
<view class="swiper-item uni-bg-green"><text class="swiper-item-Text">B</text></view>
......@@ -126,6 +126,12 @@
}
},
methods: {
swipertouchStart(e: UniTouchEvent) {
console.log("swiper touchstart")
},
viewtouchStart(e: UniTouchEvent) {
console.log("view touchstart:")
},
swiperChange: function (e : UniSwiperChangeEvent) {
this.changeDetailTest = e.detail
this.checkEventTest({
......
const PAGE_PATH = '/pages/component/swiper/swiper'
describe('swiper-touch-test', () => {
// 屏蔽 web 平台
if (process.env.uniTestPlatformInfo.startsWith('web')) {
it('other platform', () => {
expect(1).toBe(1)
})
return
}
let page
beforeAll(async () => {
page = await program.reLaunch(PAGE_PATH)
await page.waitFor(1500);
})
it('swiper-touch-test', async () => {
await program.swipe({
startPoint: {x: 246,y: 193},
endPoint: {x: 1,y: 193},
duration: 200
})
await page.waitFor(1000)
let val = await page.data('currentValChange')
console.log(val)
expect(val).toEqual(1)
})
})
......@@ -6,6 +6,7 @@ const sortTestFilePaths = [
"pages/component/list-view/list-view-refresh.test.js",
"pages/component/scroll-view/scroll-view-refresher.test.js",
"pages/component/global-events/touch-events.test.js",
"pages/component/swiper/swiper2.test.js",
"pages/component/rich-text/rich-text-complex.test.js"
]
class CustomSequencer extends Sequencer {
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册