call-method-easycom-uni-modules-composition.test.js 1.1 KB
Newer Older
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17
const PAGE_PATH = "/pages/component-instance/methods/call-method-easycom-uni-modules-composition"



let page
beforeAll(async () => {
  page = await program.reLaunch(PAGE_PATH)
  await page.waitFor('view')
})

it('callMethodTest', async () => {
  // a[[]] only issue 8582
  if (process.env.uniTestPlatformInfo.toLowerCase().startsWith('web')) {
    expect(1).toBe(1)
    return
  }

18 19 20 21 22 23 24 25 26 27 28 29 30 31
  const platformInfo = process.env.uniTestPlatformInfo.toLocaleLowerCase()
  const isIOS = process.env.uniTestPlatformInfo.toLowerCase().startsWith('ios')
  // ios_simulator ios 17.0
  // xcodoe 15 以下的版本环境不满足
  if (
    isIOS &&
    (platformInfo.indexOf('14.') != -1 ||
      platformInfo.indexOf('13.') != -1 ||
      platformInfo.indexOf('12.') != -1)
  ) {
    expect(1).toBe(1)
    return
  }

32 33 34 35
  const delay = () =>
    new Promise((resolve, _) => {
      setTimeout(() => {
        resolve('')
36
      }, 1500)
37 38 39 40 41 42 43 44 45
    })

  await page.callMethod('onButtonClick')
  await delay()
  const resStr1 = await page.$("#isNumListValid")
  const resStr2 = await page.$("#isObjListValid")
  expect(await resStr1.text()).toBe(`true`)
  expect(await resStr2.text()).toBe(`true`)
})