element-getnativeview.test.js 1.8 KB
Newer Older
DCloud-WZF's avatar
DCloud-WZF 已提交
1 2 3
const platformInfo = process.env.uniTestPlatformInfo.toLocaleLowerCase()
const isMP = platformInfo.startsWith('mp')

shutao-dc's avatar
shutao-dc 已提交
4
describe('get-native-view', () => {
DCloud-WZF's avatar
DCloud-WZF 已提交
5 6 7 8 9 10 11
  if (isMP) {
  	it('skip mp', () => {
  		expect(1).toBe(1)
  	})
  	return
  }

shutao-dc's avatar
shutao-dc 已提交
12 13 14 15 16
  if (process.env.uniTestPlatformInfo.indexOf('web') > -1 || process.env.UNI_AUTOMATOR_APP_WEBVIEW == 'true') {
    it('object', () => {
      expect(1).toBe(1)
    })
    return
17 18 19 20 21 22 23 24 25 26 27 28 29 30 31
  }

  const platformInfo = process.env.uniTestPlatformInfo.toLocaleLowerCase()

  if (
    platformInfo.indexOf('14.5') != -1 ||
    platformInfo.indexOf('13.7') != -1 ||
    platformInfo.indexOf('12.4') != -1
  ) {
    // TODO: 排查 ios 不兼容版本 测试异常原因
    it('14.5 13.7 12.4 测试异常', () => {
      expect(1).toBe(1)
    })
    return
  }
DCloud-WZF's avatar
DCloud-WZF 已提交
32 33 34 35 36 37 38 39

  let page
  beforeAll(async () => {
    page = await program.reLaunch('/pages/API/get-native-view/element-getnativeview')
    await page.waitFor('web-view')
  })

  //检测view标签原生View是否匹配
shutao-dc's avatar
shutao-dc 已提交
40
  it('check_view_native_view', async () => {
DCloud-WZF's avatar
DCloud-WZF 已提交
41 42 43
    page.waitFor(100)
    const value = await page.callMethod('checkViewNativeView')
    expect(value).toBe(true)
shutao-dc's avatar
shutao-dc 已提交
44 45
  })

shutao-dc's avatar
shutao-dc 已提交
46
  //检测input标签原生View是否匹配
shutao-dc's avatar
shutao-dc 已提交
47 48 49 50 51 52 53 54 55 56 57 58 59
  it('check_input_native_view', async () => {
    page.waitFor(100)
    const value = await page.callMethod('checkInputNativeView')
    expect(value).toBe(true)
  })

  //检测textarea标签原生View是否匹配
  it('check_textarea_native_view', async () => {
    page.waitFor(100)
    const value = await page.callMethod('checkTextareaNativeView')
    expect(value).toBe(true)
  })

shutao-dc's avatar
shutao-dc 已提交
60
  //检测webview标签原生View是否匹配
shutao-dc's avatar
shutao-dc 已提交
61 62 63 64
  it('check_web_view_native_view', async () => {
    page.waitFor(100)
    const value = await page.callMethod('checkWebViewNativeView')
    expect(value).toBe(true)
DCloud-WZF's avatar
DCloud-WZF 已提交
65 66 67
  })

})