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

更新video自动化测试用例

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