issue-16126.test.js 1.6 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374
  1. const platformInfo = process.env.uniTestPlatformInfo.toLocaleLowerCase()
  2. const isMP = platformInfo.startsWith('mp')
  3. const isWeb = platformInfo.startsWith('web')
  4. describe('issue-16162', () => {
  5. if (isMP || isWeb) {
  6. it('skip', () => {
  7. expect(1).toBe(1)
  8. })
  9. return
  10. }
  11. let page
  12. beforeAll(async () => {
  13. page = await program.reLaunch('/pages/component/list-view/issue-16126')
  14. await page.waitFor(600)
  15. })
  16. it('issue16934', async () => {
  17. await page.callMethod('setScrollTop', 2000)
  18. await page.waitFor(2000)
  19. await page.setData({
  20. 'intoview': 'item1'
  21. })
  22. await page.waitFor(600)
  23. const scrollTop = await page.callMethod('getScrollTop')
  24. expect(scrollTop).toBe(0)
  25. })
  26. it('issue16162', async () => {
  27. await page.waitFor(1000);
  28. // 模拟滑动
  29. await program.swipe({
  30. startPoint: {x: 50,y: 300},
  31. endPoint: {x: 50,y: 0},
  32. duration: 100
  33. })
  34. await page.waitFor(500)
  35. // 模拟滑动
  36. await program.swipe({
  37. startPoint: {x: 50,y: 300},
  38. endPoint: {x: 50,y: 0},
  39. duration: 100
  40. })
  41. await page.waitFor(500)
  42. await page.callMethod('changeSize')
  43. await page.waitFor(500)
  44. // 模拟滑动
  45. await program.swipe({
  46. startPoint: {x: 50,y: 300},
  47. endPoint: {x: 50,y: 0},
  48. duration: 100
  49. })
  50. await page.waitFor(500)
  51. // 模拟滑动
  52. await program.swipe({
  53. startPoint: {x: 50,y: 150},
  54. endPoint: {x: 50,y: 400},
  55. duration: 100
  56. })
  57. await page.waitFor(500)
  58. const image = await program.screenshot({
  59. fullPage: true
  60. })
  61. expect(image).toSaveImageSnapshot()
  62. })
  63. })