提交 305c4a9b 编写于 作者: DCloud-yinjiacheng's avatar DCloud-yinjiacheng

新增video自动化测试用例

上级 8f325407
// uni-app自动化测试教程: uni-app自动化测试教程: https://uniapp.dcloud.net.cn/worktile/auto/hbuilderx-extension/
describe('component-native-video', () => {
let page;
beforeAll(async () => {
page = await program.reLaunch('/pages/component/video/video');
await page.waitFor(1000);
});
it('check API play', async () => {
await page.callMethod('playTest');
await page.waitFor(500);
expect(await page.data('isPlaying')).toBe(true);
expect(await page.data('isPause')).toBe(false);
});
it('check API requestFullScreen', async () => {
await page.callMethod('requestFullScreenTest');
await page.waitFor(1000);
expect(await page.data('isFullScreen')).toBe(true);
});
it('check API exitFullScreen', async () => {
await page.callMethod('exitFullScreenTest');
await page.waitFor(1000);
expect(await page.data('isFullScreen')).toBe(false);
});
it('check API pause', async () => {
await page.callMethod('pauseTest');
await page.waitFor(500);
expect(await page.data('isPause')).toBe(true);
expect(await page.data('isPlaying')).toBe(false);
await page.callMethod('playTest');
await page.waitFor(500);
expect(await page.data('isPlaying')).toBe(true);
expect(await page.data('isPause')).toBe(false);
});
it('check API stop', async () => {
await page.callMethod('stopTest');
await page.waitFor(500);
expect(await page.data('isPause')).toBe(true);
expect(await page.data('isPlaying')).toBe(false);
});
});
\ No newline at end of file
......@@ -208,7 +208,11 @@
danmu: {
text: '要显示的文本',
color: '#FF0000'
} as Danmu
} as Danmu,
// 自动化测试
isPlaying: false,
isPause: false,
isFullScreen: false
}
},
methods: {
......@@ -357,9 +361,13 @@
// 事件
onPlay: function (res : any) {
console.log(JSON.stringify(res));
this.isPlaying = true;
this.isPause = false;
},
onPause: function (res : any) {
console.log(JSON.stringify(res));
this.isPlaying = false;
this.isPause = true;
},
onEnded: function (res : any) {
console.log(JSON.stringify(res));
......@@ -369,6 +377,7 @@
},
onFullScreenChange: function (res : any) {
console.log(JSON.stringify(res));
this.isFullScreen = !this.isFullScreen;
},
onWaiting: function (res : any) {
console.log(JSON.stringify(res));
......@@ -384,6 +393,25 @@
},
onControlsToggle: function (res : any) {
console.log(JSON.stringify(res));
},
// 自动化测试
playTest: function () {
this.videoContext?.play();
},
pauseTest: function () {
this.videoContext?.pause();
},
requestFullScreenTest: function () {
const options : RequestFullScreenOptions = {
direction: -90
};
this.videoContext?.requestFullScreen(options);
},
exitFullScreenTest: function () {
this.videoContext?.exitFullScreen();
},
stopTest: function () {
this.videoContext?.stop();
}
}
}
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册