set-page-style-disable-pull-down-refresh.test.js 2.0 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556
  1. const platformInfo = process.env.uniTestPlatformInfo.toLocaleLowerCase()
  2. const isMP = platformInfo.startsWith('mp')
  3. const isIos = platformInfo.startsWith('ios')
  4. const isHarmony = platformInfo.startsWith('harmony')
  5. const PAGE_PATH = '/pages/API/get-current-pages/set-page-style-disable-pull-down-refresh'
  6. describe('getCurrentPages', () => {
  7. if (isMP || isIos) {
  8. it('not-support', async () => {
  9. expect(1).toBe(1)
  10. })
  11. return
  12. }
  13. let page
  14. it('page-style', async () => {
  15. page = await program.navigateTo(PAGE_PATH)
  16. //onLoad会对currentPageStyle赋值
  17. await page.waitFor(200)
  18. const currentPageStyle = (await page.data()).currentPageStyle
  19. const isEnablePullDownRefresh1 = currentPageStyle.enablePullDownRefresh
  20. expect(isEnablePullDownRefresh1).toBe(false)
  21. //校验pageStyle数据是否完整
  22. expect(currentPageStyle.navigationStyle != undefined && currentPageStyle.onReachBottomDistance != undefined).toBe(true)
  23. await page.callMethod('setPageStyle', true)
  24. await page.waitFor(200)
  25. await page.callMethod('getPageStyle')
  26. await page.waitFor(200)
  27. const isEnablePullDownRefresh2 = (await page.data()).currentPageStyle.enablePullDownRefresh
  28. expect(isEnablePullDownRefresh2).toBe(true)
  29. await page.callMethod('startPullDownRefresh')
  30. await page.waitFor(500)
  31. const image3 = await program.screenshot({
  32. fullPage: true
  33. });
  34. expect(image3).toSaveImageSnapshot({customSnapshotIdentifier() {
  35. return 'set-page-style-disable-pull-down-refresh-test-js-get-current-pages-page-style-before-set-page-style'
  36. }});
  37. await page.waitFor(3500)
  38. // setPageStyle
  39. await page.callMethod('setPageStyle', false)
  40. await page.waitFor(200)
  41. await page.callMethod('startPullDownRefresh')
  42. await page.waitFor(500)
  43. const image2 = await program.screenshot({
  44. fullPage: true
  45. });
  46. expect(image2).toSaveImageSnapshot({customSnapshotIdentifier() {
  47. return 'set-page-style-disable-pull-down-refresh-test-js-get-current-pages-page-style-after-set-page-style'
  48. }});
  49. })
  50. })