rich-text-complex.test.js 1.6 KB
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 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72
const PAGE_PATH = '/pages/component/rich-text/rich-text-complex'

describe('rich-text-test', () => {

  // 先屏蔽 android 及 web 平台
  if (process.env.uniTestPlatformInfo.startsWith('android') || process.env.uniTestPlatformInfo.startsWith('web')) {
    it('other platform', () => {
      expect(1).toBe(1)
    })
    return
  }

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


  it('click-event', async () => {
    await program.tap({
      x: 210,
      y: 280,
      duration: 100
    })

    await page.waitFor(1000);
    const fViewClicked = await page.data('fViewClicked')
    const selfClicked = await page.data('selfClicked')
    expect(fViewClicked).toBe(true)
    expect(selfClicked).toBe(true)
  })


  it('itemclick-event', async () => {
    await program.tap({
      x: 66,
      y: 266,
      duration: 100
    })

    await page.waitFor(500);

    // 关闭弹窗逻辑各平台需要适配不同机型
    if (process.env.uniTestPlatformInfo.startsWith('IOS')) {
        // 关闭弹窗 iPhone Pro 机型
        await program.tap({
          x: 200,
          y: 433,
          duration: 100
        })

        // 关闭弹窗 iPhone ProMax 机型
        await program.tap({
          x: 220,
          y: 476,
          duration: 100
        })

        // 关闭弹窗 iPhone mini 机型
        await program.tap({
          x: 186,
          y: 400,
          duration: 100
        })
    }

    const imageClicked = await page.data('imageClicked')
    expect(imageClicked).toBe(true)
  })

})