swiper-list-view.test.js 944 字节
Newer Older
shutao-dc's avatar
shutao-dc 已提交
1
describe('component-swiper-list-view', () => {
2 3 4 5 6 7
  if (process.env.uniTestPlatformInfo.startsWith('mp')) {
    it('other platform', () => {
      expect(1).toBe(1)
    })
    return
  }
shutao-dc's avatar
shutao-dc 已提交
8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32
  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();
  })

})