Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
DCloud
hello uni-app x
提交
ba199899
H
hello uni-app x
项目概览
DCloud
/
hello uni-app x
通知
6067
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看板
提交
ba199899
编写于
6月 14, 2024
作者:
DCloud-yinjiacheng
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
更新image、video、web-view自动化测试用例
上级
af20178c
变更
5
隐藏空白更改
内联
并排
Showing
5 changed file
with
90 addition
and
106 deletion
+90
-106
pages/component/image/image.test.js
pages/component/image/image.test.js
+2
-6
pages/component/video/video.test.js
pages/component/video/video.test.js
+20
-30
pages/component/video/video.uvue
pages/component/video/video.uvue
+1
-1
pages/component/web-view-local/web-view-local.test.js
pages/component/web-view-local/web-view-local.test.js
+48
-48
pages/component/web-view/web-view.test.js
pages/component/web-view/web-view.test.js
+19
-21
未找到文件。
pages/component/image/image.test.js
浏览文件 @
ba199899
...
...
@@ -75,9 +75,7 @@ describe('component-native-image', () => {
autoTest
:
true
,
imageSrc
:
'
https://request.dcloud.net.cn/api/http/contentType/image/png
'
});
await
page
.
waitFor
(
async
()
=>
{
return
await
page
.
data
(
'
eventLoad
'
);
});
await
page
.
waitFor
(
300
);
expect
(
await
page
.
data
(
'
eventLoad
'
)).
toEqual
({
tagName
:
'
IMAGE
'
,
type
:
'
load
'
,
...
...
@@ -90,9 +88,7 @@ describe('component-native-image', () => {
await
page
.
setData
({
imageSrc
:
'
https://request.dcloud.net.cn/api/http/contentType/404.png
'
});
await
page
.
waitFor
(
async
()
=>
{
return
await
page
.
data
(
'
eventError
'
);
});
await
page
.
waitFor
(
300
);
expect
(
await
page
.
data
(
'
eventError
'
)).
toEqual
({
tagName
:
'
IMAGE
'
,
type
:
'
error
'
...
...
pages/component/video/video.test.js
浏览文件 @
ba199899
...
...
@@ -52,17 +52,13 @@ describe('component-native-video', () => {
autoTest
:
true
});
await
page
.
callMethod
(
'
play
'
);
await
page
.
waitFor
(
async
()
=>
{
return
await
page
.
data
(
'
eventPlay
'
);
});
await
page
.
waitFor
(
100
);
expect
(
await
page
.
data
(
'
eventPlay
'
)).
toEqual
({
tagName
:
'
VIDEO
'
,
type
:
'
play
'
});
await
page
.
callMethod
(
'
pause
'
);
await
page
.
waitFor
(
async
()
=>
{
return
await
page
.
data
(
'
eventPause
'
);
});
await
page
.
waitFor
(
100
);
expect
(
await
page
.
data
(
'
eventPause
'
)).
toEqual
({
tagName
:
'
VIDEO
'
,
type
:
'
pause
'
...
...
@@ -75,38 +71,36 @@ describe('component-native-video', () => {
pos
:
10
});
await
page
.
callMethod
(
'
seek
'
);
await
page
.
waitFor
(
async
()
=>
{
return
await
page
.
data
(
'
eventWaiting
'
);
});
await
page
.
waitFor
(
100
);
expect
(
await
page
.
data
(
'
eventWaiting
'
)).
toEqual
({
tagName
:
'
VIDEO
'
,
type
:
'
waiting
'
});
await
page
.
waitFor
(
async
()
=>
{
return
await
page
.
data
(
'
eventProgress
'
);
});
await
page
.
waitFor
(
200
);
expect
(
await
page
.
data
(
'
eventProgress
'
)).
toEqual
({
tagName
:
'
VIDEO
'
,
type
:
'
progress
'
,
buffered
:
100
});
await
page
.
waitFor
(
250
);
expect
(
await
page
.
data
(
'
eventTimeupdate
'
)).
toEqual
({
tagName
:
'
VIDEO
'
,
type
:
'
timeupdate
'
,
currentTime
:
10
,
duration
:
121
isBufferedValid
:
true
});
const
infos
=
process
.
env
.
uniTestPlatformInfo
.
split
(
'
'
);
const
version
=
parseInt
(
infos
[
infos
.
length
-
1
]);
if
(
process
.
env
.
uniTestPlatformInfo
.
startsWith
(
'
android
'
)
&&
version
>
5
)
{
await
page
.
waitFor
(
200
);
expect
(
await
page
.
data
(
'
eventTimeupdate
'
)).
toEqual
({
tagName
:
'
VIDEO
'
,
type
:
'
timeupdate
'
,
currentTime
:
10
,
duration
:
121
});
}
});
it
(
'
test event fullscreenchange fullscreenclick controlstoggle
'
,
async
()
=>
{
if
(
process
.
env
.
uniTestPlatformInfo
.
startsWith
(
'
ios
'
))
{
if
(
process
.
env
.
uniTestPlatformInfo
.
toLowerCase
().
startsWith
(
'
ios
'
))
{
return
;
}
await
page
.
callMethod
(
'
requestFullScreen
'
);
await
page
.
waitFor
(
async
()
=>
{
return
await
page
.
data
(
'
eventFullscreenchange
'
);
});
await
page
.
waitFor
(
500
);
expect
(
await
page
.
data
(
'
eventFullscreenchange
'
)).
toEqual
({
tagName
:
'
VIDEO
'
,
type
:
'
fullscreenchange
'
,
...
...
@@ -144,9 +138,7 @@ describe('component-native-video', () => {
pos
:
120
});
await
page
.
callMethod
(
'
seek
'
);
await
page
.
waitFor
(
async
()
=>
{
return
await
page
.
data
(
'
eventEnded
'
);
});
await
page
.
waitFor
(
2500
);
expect
(
await
page
.
data
(
'
eventEnded
'
)).
toEqual
({
tagName
:
'
VIDEO
'
,
type
:
'
ended
'
...
...
@@ -158,9 +150,7 @@ describe('component-native-video', () => {
await
page
.
setData
({
src
:
'
invalid url
'
});
await
page
.
waitFor
(
async
()
=>
{
return
await
page
.
data
(
'
eventError
'
);
});
await
page
.
waitFor
(
300
);
expect
(
await
page
.
data
(
'
eventError
'
)).
toEqual
({
tagName
:
'
VIDEO
'
,
type
:
'
error
'
,
...
...
pages/component/video/video.uvue
浏览文件 @
ba199899
...
...
@@ -447,7 +447,7 @@
this.eventProgress = {
"tagName": res.target?.tagName,
"type": res.type,
"
buffered": res.detail.buffered
"
isBufferedValid": res.detail.buffered > 0
};
}
},
...
...
pages/component/web-view-local/web-view-local.test.js
浏览文件 @
ba199899
...
...
@@ -27,58 +27,58 @@ describe('component-native-web-view', () => {
autoTest
:
true
});
await
page
.
callMethod
(
'
testEventDownload
'
);
await
page
.
waitFor
(
async
()
=>
{
return
await
page
.
data
(
'
eventDownload
'
);
});
if
(
process
.
env
.
uniTestPlatformInfo
.
startsWith
(
'
ios
'
))
{
expect
(
await
page
.
data
(
'
eventDownload
'
)).
toEqual
({
tagName
:
'
WEB-VIEW
'
,
type
:
'
download
'
,
url
:
'
https://web-ext-storage.dcloud.net.cn/uni-app-x/pkg/hello-uniappx.apk
'
,
userAgent
:
`uni-app-x/
${
process
.
env
.
HX_Version
.
split
(
'
-
'
)[
0
].
split
(
'
.
'
).
slice
(
0
,
2
).
join
(
'
.
'
)}
`
,
contentDisposition
:
''
,
mimetype
:
'
application/vnd.android.package-archive
'
,
isContentLengthValid
:
true
});
return
;
}
const
infos
=
process
.
env
.
uniTestPlatformInfo
.
split
(
'
'
);
const
version
=
parseInt
(
infos
[
infos
.
length
-
1
]);
if
(
version
>
8
)
{
expect
(
await
page
.
data
(
'
eventDownload
'
)).
toEqual
({
tagName
:
'
WEB-VIEW
'
,
type
:
'
download
'
,
url
:
'
https://web-ext-storage.dcloud.net.cn/uni-app-x/pkg/hello-uniappx.apk
'
,
userAgent
:
`uni-app-x/
${
process
.
env
.
HX_Version
.
split
(
'
-
'
)[
0
].
split
(
'
.
'
).
slice
(
0
,
2
).
join
(
'
.
'
)}
`
,
contentDisposition
:
`attachment; filename="hello-uniappx.apk"; filename*=utf-8''hello-uniappx.apk`
,
mimetype
:
'
application/vnd.android.package-archive
'
,
isContentLengthValid
:
true
});
}
else
{
// 低版本webview内核,部分属性无有效值
expect
(
await
page
.
data
(
'
eventDownload
'
)).
toEqual
({
tagName
:
'
WEB-VIEW
'
,
type
:
'
download
'
,
url
:
'
https://web-ext-storage.dcloud.net.cn/uni-app-x/pkg/hello-uniappx.apk
'
,
userAgent
:
''
,
contentDisposition
:
''
,
mimetype
:
''
,
isContentLengthValid
:
false
});
await
page
.
waitFor
(
500
);
if
(
process
.
env
.
uniTestPlatformInfo
.
toLowerCase
().
startsWith
(
'
ios
'
))
{
expect
(
await
page
.
data
(
'
eventDownload
'
)).
toEqual
({
tagName
:
'
WEB-VIEW
'
,
type
:
'
download
'
,
url
:
'
https://web-ext-storage.dcloud.net.cn/uni-app-x/pkg/hello-uniappx.apk
'
,
userAgent
:
`uni-app-x/
${
process
.
env
.
HX_Version
.
split
(
'
-
'
)[
0
].
split
(
'
.
'
).
slice
(
0
,
2
).
join
(
'
.
'
)}
`
,
contentDisposition
:
''
,
mimetype
:
'
application/vnd.android.package-archive
'
,
isContentLengthValid
:
true
});
return
;
}
const
infos
=
process
.
env
.
uniTestPlatformInfo
.
split
(
'
'
);
const
version
=
parseInt
(
infos
[
infos
.
length
-
1
]);
if
(
version
>
8
)
{
expect
(
await
page
.
data
(
'
eventDownload
'
)).
toEqual
({
tagName
:
'
WEB-VIEW
'
,
type
:
'
download
'
,
url
:
'
https://web-ext-storage.dcloud.net.cn/uni-app-x/pkg/hello-uniappx.apk
'
,
userAgent
:
`uni-app-x/
${
process
.
env
.
HX_Version
.
split
(
'
-
'
)[
0
].
split
(
'
.
'
).
slice
(
0
,
2
).
join
(
'
.
'
)}
`
,
contentDisposition
:
`attachment; filename="hello-uniappx.apk"; filename*=utf-8''hello-uniappx.apk`
,
mimetype
:
'
application/vnd.android.package-archive
'
,
isContentLengthValid
:
true
});
}
else
if
(
version
>
6
)
{
// 低版本webview内核,部分属性无有效值
expect
(
await
page
.
data
(
'
eventDownload
'
)).
toEqual
({
tagName
:
'
WEB-VIEW
'
,
type
:
'
download
'
,
url
:
'
https://web-ext-storage.dcloud.net.cn/uni-app-x/pkg/hello-uniappx.apk
'
,
userAgent
:
''
,
contentDisposition
:
''
,
mimetype
:
''
,
isContentLengthValid
:
false
});
}
});
it
(
'
test event message
'
,
async
()
=>
{
await
page
.
callMethod
(
'
testEventMessage
'
);
await
page
.
waitFor
(
async
()
=>
{
return
await
page
.
data
(
'
eventMessage
'
);
});
expect
(
await
page
.
data
(
'
eventMessage
'
)).
toEqual
({
tagName
:
'
WEB-VIEW
'
,
type
:
'
message
'
,
data
:
[{
action
:
'
message
'
}]
});
const
infos
=
process
.
env
.
uniTestPlatformInfo
.
split
(
'
'
);
const
version
=
parseInt
(
infos
[
infos
.
length
-
1
]);
if
(
process
.
env
.
uniTestPlatformInfo
.
startsWith
(
'
android
'
)
&&
version
>
6
)
{
await
page
.
callMethod
(
'
testEventMessage
'
);
await
page
.
waitFor
(
200
);
expect
(
await
page
.
data
(
'
eventMessage
'
)).
toEqual
({
tagName
:
'
WEB-VIEW
'
,
type
:
'
message
'
,
data
:
[{
action
:
'
message
'
}]
});
}
await
page
.
setData
({
autoTest
:
false
});
...
...
pages/component/web-view/web-view.test.js
浏览文件 @
ba199899
...
...
@@ -17,17 +17,13 @@ describe('component-native-web-view', () => {
autoTest
:
true
});
await
page
.
callMethod
(
'
reload
'
);
await
page
.
waitFor
(
async
()
=>
{
return
await
page
.
data
(
'
eventLoading
'
);
});
await
page
.
waitFor
(
100
);
expect
(
await
page
.
data
(
'
eventLoading
'
)).
toEqual
({
tagName
:
'
WEB-VIEW
'
,
type
:
'
loading
'
,
src
:
'
https://www.dcloud.io/
'
});
await
page
.
waitFor
(
async
()
=>
{
return
await
page
.
data
(
'
eventLoad
'
);
});
await
page
.
waitFor
(
1000
);
expect
(
await
page
.
data
(
'
eventLoad
'
)).
toEqual
({
tagName
:
'
WEB-VIEW
'
,
type
:
'
load
'
,
...
...
@@ -36,21 +32,23 @@ describe('component-native-web-view', () => {
});
it
(
'
test event error
'
,
async
()
=>
{
await
page
.
setData
({
src
:
'
https://www.dclou.io/uni-app-x
'
});
await
page
.
waitFor
(
async
()
=>
{
return
await
page
.
data
(
'
eventError
'
);
});
expect
(
await
page
.
data
(
'
eventError
'
)).
toEqual
({
tagName
:
'
WEB-VIEW
'
,
type
:
'
error
'
,
errCode
:
100002
,
errMsg
:
'
page error
'
,
url
:
'
https://www.dclou.io
'
,
fullUrl
:
'
https://www.dclou.io/uni-app-x
'
,
src
:
'
https://www.dclou.io/uni-app-x
'
});
const
infos
=
process
.
env
.
uniTestPlatformInfo
.
split
(
'
'
);
const
version
=
parseInt
(
infos
[
infos
.
length
-
1
]);
if
(
process
.
env
.
uniTestPlatformInfo
.
startsWith
(
'
android
'
)
&&
version
>
5
)
{
await
page
.
setData
({
src
:
'
https://www.dclou.io/uni-app-x
'
});
await
page
.
waitFor
(
500
);
expect
(
await
page
.
data
(
'
eventError
'
)).
toEqual
({
tagName
:
'
WEB-VIEW
'
,
type
:
'
error
'
,
errCode
:
100002
,
errMsg
:
'
page error
'
,
url
:
'
https://www.dclou.io
'
,
fullUrl
:
'
https://www.dclou.io/uni-app-x
'
,
src
:
'
https://www.dclou.io/uni-app-x
'
});
}
await
page
.
setData
({
autoTest
:
false
});
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录