sticky-header.test.js 1.3 KB

1234567891011121314151617181920212223242526272829303132333435363738394041
  1. const platformInfo = process.env.uniTestPlatformInfo.toLocaleLowerCase()
  2. const isMP = platformInfo.startsWith('mp')
  3. const isHarmony = platformInfo.startsWith('harmony')
  4. const isAppWebView = process.env.UNI_AUTOMATOR_APP_WEBVIEW == 'true'
  5. describe('component-native-sticky-header', () => {
  6. if (isMP || isHarmony) {
  7. it('not support', () => {
  8. expect(1).toBe(1)
  9. })
  10. return
  11. }
  12. let page
  13. const screenshotParams = { }
  14. beforeAll(async () => {
  15. if (!isAppWebView) {
  16. const windowInfo = await program.callUniMethod('getWindowInfo');
  17. screenshotParams.offsetY = `${windowInfo.safeAreaInsets.top + 44}`
  18. }
  19. page = await program.reLaunch('/pages/component/sticky-header/sticky-header')
  20. await page.waitFor('sticky-header')
  21. })
  22. //检测吸顶效果
  23. it('check_sticky_header', async () => {
  24. await page.callMethod('confirm_scroll_top_input', 600)
  25. const image = await program.screenshot(screenshotParams);
  26. expect(image).toSaveImageSnapshot();
  27. })
  28. //测试验证issues 16216 问题
  29. it('check_sticky_header_position', async () => {
  30. await page.callMethod('confirm_scroll_top_input', 300)
  31. await page.waitFor(600);
  32. await page.callMethod('clearListData')
  33. await page.waitFor(600);
  34. const image = await program.screenshot(screenshotParams);
  35. expect(image).toSaveImageSnapshot();
  36. })
  37. })