image.test.js 960 字节
Newer Older
shutao-dc's avatar
shutao-dc 已提交
1 2 3 4 5 6 7 8 9 10 11 12 13
// uni-app自动化测试教程: uni-app自动化测试教程: https://uniapp.dcloud.net.cn/worktile/auto/hbuilderx-extension/

describe('component-native-image', () => {

    let page;
    beforeAll(async () => {
        page = await program.reLaunch('/pages/component/image/image');
        await page.waitFor(600);
    });

    it('check_image_load', async () => {
         expect(await page.data('loadError')).toBe(false)
    });
shutao-dc's avatar
shutao-dc 已提交
14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31

    it('check_image_load_url', async () => {
      await page.setData({
        loadError: false,
        imageSrc: 'https://request.dcloud.net.cn/api/http/contentType/image/png'
      })
      await page.waitFor(300);
      expect(await page.data('loadError')).toBe(false)
    })
    
    it('check_image_load_error', async () => {
      await page.setData({
        loadError: false,
        imageSrc: 'testerror.jpg'
      })
      await page.waitFor(300);
      expect(await page.data('loadError')).toBe(true)
    })
shutao-dc's avatar
shutao-dc 已提交
32
});