download-file.test.js 1.3 KB
Newer Older
1 2 3 4 5 6 7 8 9 10
const PAGE_PATH = '/pages/API/download-file/download-file'

describe('ExtApi-DownloadFile', () => {

  let page;
  let res;
  beforeAll(async () => {
    page = await program.reLaunch(PAGE_PATH)
    await page.waitFor(600);
    await page.callMethod('jest_downloadFile');
11
    await page.waitFor(1000);
12
    res = await page.data('jest_result');
13 14 15 16 17 18
  });

  beforeEach(async () => {
    await page.setData({
      jest_result: false
    })
19 20 21 22
  });

  it('Check ', async () => {
    expect(res).toBe(true);
23 24
  });
  it('Check Set Cookie', async () => {
25 26 27 28 29 30 31 32 33 34
    if (process.env.uniTestPlatformInfo.startsWith('android')) {
      let version = process.env.uniTestPlatformInfo
      version = version.split(" ")[1]
      if(version > 9){
        res = await page.callMethod('jest_set_cookie')
        await page.waitFor(1000);
        res = await page.data('jest_result');
        expect(res).toBe(true)
      }
    }
35 36
  });
  it('Check Delete Cookie', async () => {
37 38 39 40 41 42 43 44 45 46
    if (process.env.uniTestPlatformInfo.startsWith('android')) {
      let version = process.env.uniTestPlatformInfo
      version = version.split(" ")[1]
      if(version > 9){
        res = await page.callMethod('jest_delete_cookie')
        await page.waitFor(1000);
        res = await page.data('jest_result');
        expect(res).toBe(true)
      }
    }
47 48
  });
});