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

更新video自动化测试用例

上级 0dc3100f
......@@ -24,6 +24,20 @@ describe('component-native-video', () => {
expect(await page.data('isPause')).toBe(true);
});
it('test local source', async () => {
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'
});
await page.waitFor(100);
expect(await page.data('isError')).toBe(false);
await page.setData({
autoTest: false
});
});
it('test format', async () => {
page = await program.navigateTo('/pages/component/video/video-format');
await page.waitFor(1000);
......
......@@ -132,6 +132,7 @@
</view>
</scroll-view>
</view>
<video v-if="autoTest" :src="localSrc" @error="onError"></video>
</template>
<script>
......@@ -217,9 +218,11 @@
color: '#FF0000'
} as Danmu,
// 自动化测试
autoTest: false,
isPlaying: false,
isPause: false,
isError: false
isError: false,
localSrc: ''
}
},
onLoad() {
......@@ -407,6 +410,19 @@
},
onControlsToggle: function (res : UniVideoControlsToggleEvent) {
console.log(res.type + " -> " + JSON.stringify(res.detail));
},
// 自动化测试
downloadSource() {
uni.downloadFile({
url: 'https://qiniu-web-assets.dcloud.net.cn/video/sample/2minute-demo.mp4',
success: (res) => {
this.localSrc = res.tempFilePath;
this.autoTest = true;
},
fail: (_) => {
this.isError = true;
}
})
}
}
}
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册