video.test.js 1.5 KB
Newer Older
1
// uni-app自动化测试教程: uni-app自动化测试教程: https://uniapp.dcloud.net.cn/worktile/auto/hbuilderx-extension/
雪洛's avatar
雪洛 已提交
2
jest.setTimeout(20000);
3 4 5 6
describe('component-native-video', () => {
  let page;

  beforeAll(async () => {
DCloud-yinjiacheng's avatar
DCloud-yinjiacheng 已提交
7
    page = await program.reLaunch('/pages/component/video/video');
8
    await page.waitFor('video');
雪洛's avatar
雪洛 已提交
9
    await page.waitFor(300)
10 11 12 13 14 15 16 17 18
  });

  it('test API', async () => {
    // play
    await page.callMethod('play');
    await page.waitFor(async () => {
      return (await page.data('isPlaying')) == true;
    });
    // requestFullScreen
19 20 21 22
    // await page.callMethod('requestFullScreen', null);
    // await page.waitFor(async () => {
    //   return (await page.data('isFullScreen')) == true;
    // });
23
    // exitFullScreen
24 25 26 27
    // await page.callMethod('exitFullScreen');
    // await page.waitFor(async () => {
    //   return (await page.data('isFullScreen')) == false;
    // });
28 29 30 31 32
    // pause
    await page.callMethod('pause');
    await page.waitFor(async () => {
      return (await page.data('isPause')) == true;
    });
33 34 35 36
    // await page.callMethod('play');
    // await page.waitFor(async () => {
    //   return (await page.data('isPlaying')) == true;
    // });
37
    // stop
38 39 40 41
    // await page.callMethod('stop');
    // await page.waitFor(async () => {
    //   return (await page.data('isPause')) == true;
    // });
42 43 44 45 46 47 48 49
  });

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