element-getnativeview.test.js 1.8 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465
  1. const platformInfo = process.env.uniTestPlatformInfo.toLocaleLowerCase()
  2. const isMP = platformInfo.startsWith('mp')
  3. const isWeb = platformInfo.startsWith('web')
  4. const isIOS = platformInfo.startsWith('ios')
  5. const isHarmony = platformInfo.startsWith('harmony')
  6. const isAppWebView = process.env.UNI_AUTOMATOR_APP_WEBVIEW == 'true'
  7. describe('get-native-view', () => {
  8. if (isMP || isHarmony || isWeb || isAppWebView) {
  9. it('skip mp', () => {
  10. expect(1).toBe(1)
  11. })
  12. return
  13. }
  14. if (
  15. isIOS &&
  16. (
  17. platformInfo.indexOf('14.5') != -1 ||
  18. platformInfo.indexOf('13.7') != -1 ||
  19. platformInfo.indexOf('12.4') != -1
  20. )
  21. ) {
  22. // TODO: 排查 ios 不兼容版本 测试异常原因
  23. it('14.5 13.7 12.4 测试异常', () => {
  24. expect(1).toBe(1)
  25. })
  26. return
  27. }
  28. let page
  29. beforeAll(async () => {
  30. page = await program.reLaunch('/pages/API/get-native-view/element-getnativeview')
  31. await page.waitFor('web-view')
  32. })
  33. //检测view标签原生View是否匹配
  34. it('check_view_native_view', async () => {
  35. page.waitFor(100)
  36. const value = await page.callMethod('checkViewNativeView')
  37. expect(value).toBe(true)
  38. })
  39. //检测input标签原生View是否匹配
  40. it('check_input_native_view', async () => {
  41. page.waitFor(100)
  42. const value = await page.callMethod('checkInputNativeView')
  43. expect(value).toBe(true)
  44. })
  45. //检测textarea标签原生View是否匹配
  46. it('check_textarea_native_view', async () => {
  47. page.waitFor(100)
  48. const value = await page.callMethod('checkTextareaNativeView')
  49. expect(value).toBe(true)
  50. })
  51. //检测webview标签原生View是否匹配
  52. it('check_web_view_native_view', async () => {
  53. page.waitFor(100)
  54. const value = await page.callMethod('checkWebViewNativeView')
  55. expect(value).toBe(true)
  56. })
  57. })