video.test.js 1.5 KB
Newer Older
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17
// uni-app自动化测试教程: uni-app自动化测试教程: https://uniapp.dcloud.net.cn/worktile/auto/hbuilderx-extension/
jest.setTimeout(10000);
describe('component-native-video', () => {
  let page;

  beforeAll(async () => {
    page = await program.reLaunch('/pages/component/video/video-all');
    await page.waitFor('video');
  });

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

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