scroll-view-custom-refresher-props.test.js 1.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263
  1. const PAGE_PATH = '/pages/component/scroll-view/scroll-view-custom-refresher-props'
  2. const platformInfo = process.env.uniTestPlatformInfo.toLocaleLowerCase()
  3. const isWeb = platformInfo.startsWith('web')
  4. const isMP = platformInfo.startsWith('mp')
  5. describe('touch-events-test', () => {
  6. if (isWeb || isMP || process.env.UNI_TEST_DEVICES_DIRECTION == 'landscape') {
  7. it('not support', () => {
  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('view');
  16. })
  17. it('test-screenshot-custom-refresher', async () => {
  18. await page.waitFor(300);
  19. const windowInfo = await program.callUniMethod('getWindowInfo');
  20. const image = await program.screenshot({
  21. deviceShot: true,
  22. area: {
  23. x: 0,
  24. y: windowInfo.safeAreaInsets.top + 44
  25. }
  26. });
  27. expect(image).toSaveImageSnapshot();
  28. })
  29. it('test-custom-refresher', async () => {
  30. let x = 100
  31. let y = 250
  32. await page.setData({
  33. triggered: false,
  34. listCount: 5
  35. })
  36. await page.waitFor(500);
  37. // 滑动事件
  38. await program.swipe({
  39. startPoint: {
  40. x: x,
  41. y: y
  42. },
  43. endPoint: {
  44. x: x,
  45. y: y + 100
  46. },
  47. duration: 300
  48. })
  49. await page.waitFor(500);
  50. const ret = await page.data('triggered')
  51. expect(ret).toBe(true)
  52. })
  53. })