swiper-list-view.test.js 1017 B

1234567891011121314151617181920212223242526272829303132333435
  1. const platformInfo = process.env.uniTestPlatformInfo.toLocaleLowerCase()
  2. const isMP = platformInfo.startsWith('mp')
  3. describe('component-swiper-list-view', () => {
  4. if (isMP) {
  5. it('other platform', () => {
  6. expect(1).toBe(1)
  7. })
  8. return
  9. }
  10. let page
  11. beforeAll(async () => {
  12. //打开swiper-list-view测试页
  13. page = await program.reLaunch('/pages/component/swiper/swiper-list-view')
  14. await page.waitFor('list-view')
  15. })
  16. it('check-sticky-header', async () => {
  17. await page.setData({scrollTop: 300})
  18. await page.waitFor(600)
  19. await page.setData({currentVal: 1})
  20. await page.waitFor(async () => {
  21. return await page.data('swiperCurrentIndex') === 1;
  22. });
  23. await page.waitFor(200)
  24. await page.setData({currentVal: 0})
  25. await page.waitFor(async () => {
  26. return await page.data('swiperCurrentIndex') === 0;
  27. });
  28. await page.waitFor(600)
  29. const image = await program.screenshot({fullPage: true});
  30. expect(image).toSaveImageSnapshot();
  31. })
  32. })