提交 584e9518 编写于 作者: DCloud-yinjiacheng's avatar DCloud-yinjiacheng

更新video自动化测试用例

上级 5dc9c1d2
......@@ -88,6 +88,7 @@
src: 'https://qiniu-web-assets.dcloud.net.cn/video/sample/2minute-demo.avi'
}
] as Array<VideoFormat>,
// 自动化测试
isError: false
}
},
......
// uni-app自动化测试教程: uni-app自动化测试教程: https://uniapp.dcloud.net.cn/worktile/auto/hbuilderx-extension/
jest.setTimeout(20000);
describe('component-native-video', () => {
if(process.env.uniTestPlatformInfo.startsWith('web')){
// TODO: web 端暂不支持测试
......@@ -9,47 +7,25 @@ describe('component-native-video', () => {
return
}
let page;
beforeAll(async () => {
page = await program.reLaunch('/pages/component/video/video');
await page.waitFor('video');
await page.waitFor(300)
await page.waitFor(1000);
});
it('test API', async () => {
expect(await page.data('isError')).toBe(false);
// play
await page.callMethod('play');
await page.waitFor(async () => {
return (await page.data('isPlaying')) == true;
});
// requestFullScreen
// await page.callMethod('requestFullScreen', null);
// await page.waitFor(async () => {
// return (await page.data('isFullScreen')) == true;
// });
// exitFullScreen
// await page.callMethod('exitFullScreen');
// await page.waitFor(async () => {
// return (await page.data('isFullScreen')) == false;
// });
await page.waitFor(100);
expect(await page.data('isPlaying')).toBe(true);
// pause
await page.callMethod('pause');
await page.waitFor(async () => {
return (await page.data('isPause')) == true;
});
// await page.callMethod('play');
// await page.waitFor(async () => {
// return (await page.data('isPlaying')) == true;
// });
// stop
// await page.callMethod('stop');
// await page.waitFor(async () => {
// return (await page.data('isPause')) == true;
// });
await page.waitFor(100);
expect(await page.data('isPause')).toBe(true);
});
it('test format', async () => {
page = await program.reLaunch('/pages/component/video/video-format');
page = await program.navigateTo('/pages/component/video/video-format');
await page.waitFor(1000);
expect(await page.data('isError')).toBe(false);
});
......
......@@ -219,7 +219,7 @@
// 自动化测试
isPlaying: false,
isPause: false,
isFullScreen: false
isError: false
}
},
onLoad() {
......@@ -391,13 +391,13 @@
},
onFullScreenChange: function (res : UniVideoFullScreenChangeEvent) {
console.log(res.type + " -> " + JSON.stringify(res.detail));
this.isFullScreen = !this.isFullScreen;
},
onWaiting: function (res : UniEvent) {
console.log(res.type);
},
onError: function (res : UniVideoErrorEvent) {
console.log(res.type + " -> " + JSON.stringify(res.detail));
this.isError = true;
},
onProgress: function (res : UniVideoProgressEvent) {
console.log(res.type + " -> " + JSON.stringify(res.detail));
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册