clipboard.test.js 875 字节
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
let page;
describe('web-clipboard', () => {
  console.log("uniTestPlatformInfo", process.env.uniTestPlatformInfo)
  if (!process.env.uniTestPlatformInfo.startsWith('web')) {
    it('app', () => {
      expect(1).toBe(1)
    })
    return
  }
  beforeAll(async () => {
    page = await program.reLaunch('/pages/API/clipboard/clipboard')
    await page.waitFor('view');
    await page.setData({data:'123456'})
  });
  it('setClipboardData', async () => {
    await page.callMethod('setClipboard')
    await page.waitFor(500);
    console.log(await page.data('setClipboardTest'),'setClipboardTest')
    // bug:自动化测试时设置成功也进入了fail
    // expect(await page.data('setClipboardTest')).toBeTruthy()
  });
  it('getClipboardData', async () => {
    await page.callMethod('getClipboard')
    expect(await page.data('getDataTest')).toBe('123456')
  });
});