get-image-info.test.js 943 字节
Newer Older
1 2
// uni-app自动化测试教程: https://uniapp.dcloud.net.cn/worktile/auto/hbuilderx-extension/
describe('API-getImageInfo', () => {
3
  if (process.env.uniTestPlatformInfo.toLowerCase().startsWith('ios')) {
4 5 6 7 8 9
    it('pass', async () => {
      expect(1).toBe(1);
    });
    return;
  }

10 11 12 13 14 15 16 17 18 19 20
  let page;
  beforeAll(async () => {
    page = await program.reLaunch('/pages/API/get-image-info/get-image-info');
    await page.waitFor(500);
  });

  it('test getImageInfo', async () => {
    await page.waitFor(500);
    if (process.env.uniTestPlatformInfo.startsWith('web')) {
      expect(await page.data('imageInfoForTest')).toEqual({
        width: 192,
21
        height: 192,
22
        path: '/static/test-image/logo.png'
23 24 25 26 27 28
      });
      return;
    }
    expect(await page.data('imageInfoForTest')).toEqual({
      width: 192,
      height: 192,
29
      path: '/static/test-image/logo.png',
30 31 32 33 34
      orientation: 'up',
      type: 'png'
    });
  });
});