rich-text.test.js 1.5 KB
Newer Older
1 2 3 4 5
const PAGE_PATH = '/pages/component/rich-text/rich-text'

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

  // 先屏蔽 android 及 web 平台
6
  if (process.env.uniTestPlatformInfo.startsWith('web')) {
7 8 9 10 11 12 13 14 15
    it('other platform', () => {
      expect(1).toBe(1)
    })
    return
  }

  let page
  beforeAll(async () => {
    page = await program.reLaunch(PAGE_PATH)
16
    await page.waitFor(1500);
17 18 19 20 21
  })


  it('richt-text-height', async () => {
    let beforeValue = await page.data('richTextHeight')
22
    if (beforeValue < 10) {
23 24 25
      await page.waitFor(1000)
      beforeValue = await page.data('richTextHeight')
    }
26 27 28
    await page.callMethod('changeText')
    await page.waitFor(500)
    await page.callMethod('changeText')
29
    await page.waitFor(1000)
30 31 32 33 34
    let afterValue = await page.data('richTextHeight')
    console.log('beforeValue:', beforeValue)
    console.log('afterValue:', afterValue)
    expect(beforeValue).toBe(afterValue)
  })
35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53

  it('test selectable itemclick', async () => {
    await page.setData({
      autoTest: true,
      isItemClickTrigger: false
    });
    await page.waitFor(1000);
    const info = await page.callMethod('getWindowInfoForTest');
    const rect = await page.callMethod('getBoundingClientRectForTest');
    await program.tap({
      x: (rect.right - rect.left) / 2,
      y: info.statusBarHeight + 44 + (rect.bottom - rect.top) / 2
    });
    await page.waitFor(1000);
    expect(await page.data('isItemClickTrigger')).toBe(true);
    await page.setData({
      autoTest: false
    });
  });
54 55

})