Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
DCloud
hello uni-app x
提交
f1faa3a9
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看板
提交
f1faa3a9
编写于
1月 09, 2024
作者:
DCloud-WZF
💬
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
test: 截图对比测试优化 webview src 为发行地址
上级
b1c5c7f2
变更
2
显示空白变更内容
内联
并排
Showing
2 changed file
with
23 addition
and
26 deletion
+23
-26
pages/webview-screenshot-comparison/webview-screenshot-comparison.test.js
...reenshot-comparison/webview-screenshot-comparison.test.js
+11
-13
pages/webview-screenshot-comparison/webview-screenshot-comparison.uvue
...-screenshot-comparison/webview-screenshot-comparison.uvue
+12
-13
未找到文件。
pages/webview-screenshot-comparison/webview-screenshot-comparison.test.js
浏览文件 @
f1faa3a9
...
@@ -234,13 +234,13 @@ describe("shot-compare", () => {
...
@@ -234,13 +234,13 @@ describe("shot-compare", () => {
page
=
await
program
.
reLaunch
(
PAGE_PATH
);
page
=
await
program
.
reLaunch
(
PAGE_PATH
);
await
page
.
waitFor
(
500
);
await
page
.
waitFor
(
500
);
//
pre check
webview-screenshot-comparison page baseSrc
//
set
webview-screenshot-comparison page baseSrc
const
data
=
await
page
.
data
();
baseSrc
=
const
_baseSrc
=
data
[
"
baseSrc
"
];
process
.
env
.
UNI_WEB_SERVICE_URL
||
if
(
!
_baseSrc
)
{
"
http://test.dcloud.io/unix_h5_build/98_dev_hello-uni-app-x/#/
"
;
throw
new
Error
(
"
webview-screenshot-comparison page baseSrc is null
"
);
page
.
setData
({
}
baseSrc
,
baseSrc
=
_baseSrc
;
})
;
});
});
beforeEach
(
async
()
=>
{
beforeEach
(
async
()
=>
{
...
@@ -267,8 +267,7 @@ describe("shot-compare", () => {
...
@@ -267,8 +267,7 @@ describe("shot-compare", () => {
const
isLoaded
=
page
.
data
(
"
isLoaded
"
);
const
isLoaded
=
page
.
data
(
"
isLoaded
"
);
return
isLoaded
||
Date
.
now
()
-
startTime
>
10000
;
return
isLoaded
||
Date
.
now
()
-
startTime
>
10000
;
});
});
// 这个等待无法保证 web 页面加载完成,可以等 web 服务调整为发行服务后进行优化
await
page
.
waitFor
(
200
);
await
page
.
waitFor
(
4000
);
}
}
await
page
.
setData
({
await
page
.
setData
({
src
:
`
${
baseSrc
}${
pages
[
pageIndex
]}
`
,
src
:
`
${
baseSrc
}${
pages
[
pageIndex
]}
`
,
...
@@ -279,10 +278,9 @@ describe("shot-compare", () => {
...
@@ -279,10 +278,9 @@ describe("shot-compare", () => {
const
startTime
=
Date
.
now
();
const
startTime
=
Date
.
now
();
await
page
.
waitFor
(
async
()
=>
{
await
page
.
waitFor
(
async
()
=>
{
const
isLoaded
=
page
.
data
(
"
isLoaded
"
);
const
isLoaded
=
page
.
data
(
"
isLoaded
"
);
return
isLoaded
||
Date
.
now
()
-
startTime
>
10
000
;
return
isLoaded
||
Date
.
now
()
-
startTime
>
3
000
;
});
});
// 这个等待无法保证 web 页面加载完成,可以等 web 服务调整为发行服务后进行优化
await
page
.
waitFor
(
200
);
await
page
.
waitFor
(
4000
);
if
(
pages
[
pageIndex
].
includes
(
"
load-font-face
"
))
{
if
(
pages
[
pageIndex
].
includes
(
"
load-font-face
"
))
{
await
page
.
waitFor
(
3000
);
await
page
.
waitFor
(
3000
);
}
}
...
@@ -308,7 +306,7 @@ describe("shot-compare", () => {
...
@@ -308,7 +306,7 @@ describe("shot-compare", () => {
page
=
await
program
[
navigateMethod
](
`/
${
pages
[
pageIndex
]}
`
);
page
=
await
program
[
navigateMethod
](
`/
${
pages
[
pageIndex
]}
`
);
await
page
.
waitFor
(
500
);
await
page
.
waitFor
(
500
);
if
(
pages
[
pageIndex
].
includes
(
"
load-font-face
"
))
{
if
(
pages
[
pageIndex
].
includes
(
"
load-font-face
"
))
{
await
page
.
waitFor
(
2
000
);
await
page
.
waitFor
(
3
000
);
}
}
const
appAndroidSnapshot
=
await
program
.
screenshot
({
const
appAndroidSnapshot
=
await
program
.
screenshot
({
fullPage
:
isNeedAdbScreenshot
?
false
:
true
,
fullPage
:
isNeedAdbScreenshot
?
false
:
true
,
...
...
pages/webview-screenshot-comparison/webview-screenshot-comparison.uvue
浏览文件 @
f1faa3a9
...
@@ -8,7 +8,6 @@
...
@@ -8,7 +8,6 @@
export default {
export default {
data() {
data() {
return {
return {
// example baseSrc: 'http://ip:port/#/',
baseSrc: '',
baseSrc: '',
src: '',
src: '',
webviewContext: null as WebviewContext | null,
webviewContext: null as WebviewContext | null,
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录