call-method-easycom-uni-modules-composition.test.js 755 字节
Newer Older
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31
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
  }

  const delay = () =>
    new Promise((resolve, _) => {
      setTimeout(() => {
        resolve('')
      }, 1000)
    })

  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`)
})