swiper-list-view.test.js 807 字节
Newer Older
shutao-dc's avatar
shutao-dc 已提交
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26
describe('component-swiper-list-view', () => {
  let page
  beforeAll(async () => {
    //打开swiper-list-view测试页
    page = await program.reLaunch('/pages/component/swiper/swiper-list-view')
    await page.waitFor('list-view')
  })

  it('check-sticky-header', async () => {
    await page.setData({scrollTop: 300})
    await page.waitFor(600)
    await page.setData({currentVal: 1})
    await page.waitFor(async () => {
      return await page.data('swiperCurrentIndex') === 1;
    });
    await page.waitFor(200)
    await page.setData({currentVal: 0})
    await page.waitFor(async () => {
      return await page.data('swiperCurrentIndex') === 0;
    });
    await page.waitFor(600)
    const image = await program.screenshot({fullPage: true});
    expect(image).toSaveImageSnapshot();
  })

})