video.test.js 905 字节
Newer Older
1
describe('component-native-video', () => {
雪洛's avatar
雪洛 已提交
2 3 4 5 6 7 8
  if(process.env.uniTestPlatformInfo.startsWith('web')){
    // TODO: web 端暂不支持测试
    it('web', async () => {
      expect(1).toBe(1)
    })
    return
  }
9 10
  let page;
  beforeAll(async () => {
DCloud-yinjiacheng's avatar
DCloud-yinjiacheng 已提交
11
    page = await program.reLaunch('/pages/component/video/video');
12
    await page.waitFor(1000);
13 14 15
  });

  it('test API', async () => {
16
    expect(await page.data('isError')).toBe(false);
17 18
    // play
    await page.callMethod('play');
19 20
    await page.waitFor(100);
    expect(await page.data('isPlaying')).toBe(true);
21 22
    // pause
    await page.callMethod('pause');
23 24
    await page.waitFor(100);
    expect(await page.data('isPause')).toBe(true);
25 26 27
  });

  it('test format', async () => {
28
    page = await program.navigateTo('/pages/component/video/video-format');
29 30 31 32
    await page.waitFor(1000);
    expect(await page.data('isError')).toBe(false);
  });
});