提交 24bb0478 编写于 作者: DCloud-yinjiacheng's avatar DCloud-yinjiacheng

更新video自动化测试用例

上级 ce0f4b5e
......@@ -35,23 +35,21 @@ describe('component-native-video', () => {
autoTest: true,
isError: false
});
const oldSrc = await page.data('src');
await page.callMethod('downloadSource');
await page.waitFor(5000);
expect(await page.data('isError')).toBe(false);
await page.setData({
localSrc: '/static/test-video/2minute-demo.m3u8'
src: '/static/test-video/2minute-demo.m3u8'
});
await page.waitFor(100);
expect(await page.data('isError')).toBe(false);
await page.setData({
autoTest: false
src: oldSrc
});
});
it('test event play pause', async () => {
await page.setData({
autoTest: true
});
it('test event play pause controlstoggle', async () => {
await page.callMethod('play');
start = Date.now();
await page.waitFor(async () => {
......@@ -67,7 +65,6 @@ describe('component-native-video', () => {
type: 'play'
});
}
await page.callMethod('pause');
start = Date.now();
await page.waitFor(async () => {
......@@ -83,8 +80,16 @@ describe('component-native-video', () => {
type: 'pause'
});
}
await page.callMethod('play');
start = Date.now();
await page.waitFor(async () => {
return (await page.data('eventControlstoggle')) || (Date.now() - start > 500);
});
expect(await page.data('eventControlstoggle')).toEqual({
tagName: 'VIDEO',
type: 'controlstoggle',
show: true
});
});
it('test event waiting progress', async () => {
......@@ -110,7 +115,7 @@ describe('component-native-video', () => {
});
});
it('test event fullscreenchange controlstoggle fullscreenclick', async () => {
it('test event fullscreenchange fullscreenclick', async () => {
if (process.env.uniTestPlatformInfo.toLowerCase().startsWith('ios')) {
return;
}
......@@ -132,12 +137,7 @@ describe('component-native-video', () => {
await program.adbCommand('input tap 10 10');
start = Date.now();
await page.waitFor(async () => {
return (await page.data('eventControlstoggle')) && (await page.data('eventFullscreenclick')) || (Date.now() - start > 500);
});
expect(await page.data('eventControlstoggle')).toEqual({
tagName: 'VIDEO',
type: 'controlstoggle',
show: true
return (await page.data('eventFullscreenclick')) || (Date.now() - start > 500);
});
const res = await program.adbCommand('wm size');
const width = res.data.split(' ').at(-1).split('x')[0];
......@@ -166,7 +166,7 @@ describe('component-native-video', () => {
await page.callMethod('seek');
start = Date.now();
await page.waitFor(async () => {
return (await page.data('eventEnded')) || (Date.now() - start > 3000);
return (await page.data('eventEnded')) || (Date.now() - start > 5000);
});
expect(await page.data('eventEnded')).toEqual({
tagName: 'VIDEO',
......
......@@ -82,7 +82,6 @@
<enum-data title="设置解码器(仅 App 平台,播放前设置有效)" :items="codecItemTypes" @change="onCodecChange"></enum-data>
<enum-data title="设置播放策略(仅 App 平台,播放前设置有效)" :items="playStrategyItemTypes" @change="onPlayStrategyChange"></enum-data>
</scroll-view>
<video v-if="autoTest" :src="localSrc" @error="onError"></video>
</view>
</template>
......@@ -160,9 +159,7 @@
} as UTSJSONObject,
// API
pos: 0,
requestFullScreenOptions: {
direction: -90
} as RequestFullScreenOptions,
requestFullScreenOptions: null as RequestFullScreenOptions | null,
danmu: {
text: '要显示的文本',
color: '#FF0000'
......@@ -175,7 +172,6 @@
isPlaying: false,
isPause: false,
isError: false,
localSrc: 'https://qiniu-web-assets.dcloud.net.cn/video/sample/2minute-demo.mp4',
eventPlay: null as UTSJSONObject | null,
eventPause: null as UTSJSONObject | null,
eventEnded: null as UTSJSONObject | null,
......@@ -480,7 +476,7 @@
uni.downloadFile({
url: 'https://qiniu-web-assets.dcloud.net.cn/video/sample/2minute-demo.mp4',
success: (res) => {
this.localSrc = res.tempFilePath;
this.src = res.tempFilePath;
},
fail: (_) => {
this.isError = true;
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册