swiper2.test.js 750 字节
Newer Older
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21
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 () => {

22 23 24
    let x = await page.data('swipeX')
    let y = await page.data('swipeY')

25
    await program.swipe({
26 27
      startPoint: {x: x,y: y},
      endPoint: {x: 10,y: y},
28 29 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)
  })

})