swiper2.test.js 890 字节
Newer Older
DCloud-WZF's avatar
DCloud-WZF 已提交
1
const PAGE_PATH = '/pages/component/swiper/swiper'
2

DCloud-WZF's avatar
DCloud-WZF 已提交
3 4 5 6 7 8
describe('swiper-touch-test', () => {
const platformInfo = process.env.uniTestPlatformInfo.toLocaleLowerCase()
const isAndroid = platformInfo.startsWith('android')
const isWeb = platformInfo.startsWith('web')
  // 屏蔽 web * android 平台
  if (isWeb || isAndroid) {
9 10 11 12 13
    it('other platform', () => {
      expect(1).toBe(1)
    })
    return
  }
DCloud-WZF's avatar
DCloud-WZF 已提交
14 15 16 17 18 19

  let page
  beforeAll(async () => {
    page = await program.reLaunch(PAGE_PATH)
    await page.waitFor(1500);
  })
20 21 22 23


  it('swiper-touch-test', async () => {

24 25 26
    let x = await page.data('swipeX')
    let y = await page.data('swipeY')

27
    await program.swipe({
28 29
      startPoint: {x: x,y: y},
      endPoint: {x: 10,y: y},
30 31 32 33 34 35 36 37
      duration: 200
    })

    await page.waitFor(1000)
    let val = await page.data('currentValChange')
    console.log(val)
    expect(val).toEqual(1)
  })
DCloud-WZF's avatar
DCloud-WZF 已提交
38

39
})