swiper-anim.test.js 961 B

1234567891011121314151617181920212223242526272829303132333435363738394041
  1. const PAGE_PATH = '/pages/component/swiper/swiper-anim'
  2. describe('swiper-touch-test', () => {
  3. const platformInfo = process.env.uniTestPlatformInfo.toLocaleLowerCase()
  4. const isAndroid = platformInfo.startsWith('android')
  5. // 仅测试Android平台
  6. if (!isAndroid) {
  7. it('other platform', () => {
  8. expect(1).toBe(1)
  9. })
  10. return
  11. }
  12. let page
  13. beforeAll(async () => {
  14. page = await program.reLaunch(PAGE_PATH)
  15. await page.waitFor(100);
  16. })
  17. it('swiper-anim-test', async () => {
  18. await page.waitFor(1500);
  19. const res = await page.callMethod('jest_getWindowInfo')
  20. const windowHeight = res.windowHeight * res.pixelRatio;
  21. const windowWidth = res.windowWidth * res.pixelRatio;
  22. const image = await program.screenshot({
  23. deviceShot: true,
  24. area: {
  25. x: 0,
  26. y: 60,
  27. height: windowHeight - 60,
  28. width:windowWidth
  29. },
  30. });
  31. expect(image).toSaveImageSnapshot();
  32. })
  33. })