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