Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
DCloud
hello uni-app x
提交
584e9518
H
hello uni-app x
项目概览
DCloud
/
hello uni-app x
通知
6005
Star
91
Fork
164
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
18
列表
看板
标记
里程碑
合并请求
1
DevOps
流水线
流水线任务
计划
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
H
hello uni-app x
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
18
Issue
18
列表
看板
标记
里程碑
合并请求
1
合并请求
1
Pages
DevOps
DevOps
流水线
流水线任务
计划
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
流水线任务
提交
Issue看板
提交
584e9518
编写于
3月 20, 2024
作者:
DCloud-yinjiacheng
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
更新video自动化测试用例
上级
5dc9c1d2
变更
3
隐藏空白更改
内联
并排
Showing
3 changed file
with
10 addition
and
33 deletion
+10
-33
pages/component/video/video-format.uvue
pages/component/video/video-format.uvue
+1
-0
pages/component/video/video.test.js
pages/component/video/video.test.js
+7
-31
pages/component/video/video.uvue
pages/component/video/video.uvue
+2
-2
未找到文件。
pages/component/video/video-format.uvue
浏览文件 @
584e9518
...
@@ -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
}
}
},
},
...
...
pages/component/video/video.test.js
浏览文件 @
584e9518
// 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
);
});
});
...
...
pages/component/video/video.uvue
浏览文件 @
584e9518
...
@@ -219,7 +219,7 @@
...
@@ -219,7 +219,7 @@
// 自动化测试
// 自动化测试
isPlaying: false,
isPlaying: false,
isPause: false,
isPause: false,
is
FullScreen
: false
is
Error
: 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.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录