Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
DCloud
hello uni-app x
提交
28149372
H
hello uni-app x
项目概览
DCloud
/
hello uni-app x
通知
6018
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看板
提交
28149372
编写于
6月 19, 2024
作者:
DCloud-WZF
💬
提交者:
雪洛
6月 27, 2024
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
test(getCurrentPages): 补充 toSaveImageSnapshot 自定义文件名示例
上级
2c76acf5
变更
2
隐藏空白更改
内联
并排
Showing
2 changed file
with
38 addition
and
30 deletion
+38
-30
pages/API/get-current-pages/get-current-pages.test.js
pages/API/get-current-pages/get-current-pages.test.js
+32
-28
pages/API/get-current-pages/set-page-style-disable-pull-down-refresh.test.js
...nt-pages/set-page-style-disable-pull-down-refresh.test.js
+6
-2
未找到文件。
pages/API/get-current-pages/get-current-pages.test.js
浏览文件 @
28149372
const
HOME_PAGE_PATH
=
'
/pages/tabBar/component
'
const
HOME_PAGE_PATH
=
'
/pages/tabBar/component
'
const
PAGE_PATH
=
'
/pages/API/get-current-pages/get-current-pages
'
const
PAGE_PATH
=
'
/pages/API/get-current-pages/get-current-pages
'
describe
(
'
getCurrentPages
'
,
()
=>
{
describe
(
'
getCurrentPages
'
,
()
=>
{
let
page
let
page
it
(
'
getCurrentPages
'
,
async
()
=>
{
it
(
'
getCurrentPages
'
,
async
()
=>
{
// web 端等待应用首页加载完成
// web 端等待应用首页加载完成
if
(
process
.
env
.
uniTestPlatformInfo
.
startsWith
(
'
web
'
))
{
if
(
process
.
env
.
uniTestPlatformInfo
.
startsWith
(
'
web
'
))
{
const
waitTime
=
process
.
env
.
uniTestPlatformInfo
.
includes
(
'
safari
'
)
?
const
waitTime
=
process
.
env
.
uniTestPlatformInfo
.
includes
(
'
safari
'
)
?
5000
:
5000
:
3000
3000
await
new
Promise
((
resolve
)
=>
{
await
new
Promise
((
resolve
)
=>
{
setTimeout
(()
=>
{
setTimeout
(()
=>
{
resolve
()
resolve
()
},
waitTime
)
},
waitTime
)
})
})
}
}
page
=
await
program
.
switchTab
(
HOME_PAGE_PATH
)
page
=
await
program
.
switchTab
(
HOME_PAGE_PATH
)
await
page
.
waitFor
(
1000
)
await
page
.
waitFor
(
1000
)
page
=
await
program
.
navigateTo
(
PAGE_PATH
)
page
=
await
program
.
navigateTo
(
PAGE_PATH
)
await
page
.
waitFor
(
1000
)
await
page
.
waitFor
(
1000
)
await
page
.
callMethod
(
'
_getCurrentPages
'
)
await
page
.
callMethod
(
'
_getCurrentPages
'
)
await
page
.
waitFor
(
200
)
await
page
.
waitFor
(
200
)
const
data
=
await
page
.
data
()
const
data
=
await
page
.
data
()
expect
(
data
.
checked
).
toBe
(
true
)
expect
(
data
.
checked
).
toBe
(
true
)
})
})
it
(
'
page-style
'
,
async
()
=>
{
it
(
'
page-style
'
,
async
()
=>
{
page
=
await
program
.
navigateTo
(
PAGE_PATH
)
page
=
await
program
.
navigateTo
(
PAGE_PATH
)
...
@@ -47,7 +47,9 @@ describe('getCurrentPages', () => {
...
@@ -47,7 +47,9 @@ describe('getCurrentPages', () => {
await
page
.
callMethod
(
'
startPullDownRefresh
'
)
await
page
.
callMethod
(
'
startPullDownRefresh
'
)
await
page
.
waitFor
(
500
)
await
page
.
waitFor
(
500
)
const
image2
=
await
program
.
screenshot
({
fullPage
:
true
});
const
image2
=
await
program
.
screenshot
({
fullPage
:
true
});
expect
(
image2
).
toSaveImageSnapshot
();
expect
(
image2
).
toSaveImageSnapshot
({
customSnapshotIdentifier
()
{
return
'
get-current-pages-test-js-get-current-pages-page-style-before-set-page-style
'
}});
await
page
.
waitFor
(
3500
)
await
page
.
waitFor
(
3500
)
await
page
.
callMethod
(
'
setPageStyle
'
,
{
await
page
.
callMethod
(
'
setPageStyle
'
,
{
...
@@ -57,6 +59,8 @@ describe('getCurrentPages', () => {
...
@@ -57,6 +59,8 @@ describe('getCurrentPages', () => {
await
page
.
callMethod
(
'
startPullDownRefresh
'
)
await
page
.
callMethod
(
'
startPullDownRefresh
'
)
await
page
.
waitFor
(
500
)
await
page
.
waitFor
(
500
)
const
image3
=
await
program
.
screenshot
({
fullPage
:
true
});
const
image3
=
await
program
.
screenshot
({
fullPage
:
true
});
expect
(
image3
).
toSaveImageSnapshot
();
expect
(
image3
).
toSaveImageSnapshot
({
customSnapshotIdentifier
()
{
})
return
'
get-current-pages-test-js-get-current-pages-page-style-after-set-page-style
'
}});
})
})
})
pages/API/get-current-pages/set-page-style-disable-pull-down-refresh.test.js
浏览文件 @
28149372
...
@@ -27,7 +27,9 @@ describe('getCurrentPages', () => {
...
@@ -27,7 +27,9 @@ describe('getCurrentPages', () => {
const
image3
=
await
program
.
screenshot
({
const
image3
=
await
program
.
screenshot
({
fullPage
:
true
fullPage
:
true
});
});
expect
(
image3
).
toSaveImageSnapshot
();
expect
(
image3
).
toSaveImageSnapshot
({
customSnapshotIdentifier
()
{
return
'
set-page-style-disable-pull-down-refresh-test-js-get-current-pages-page-style-before-set-page-style
'
}});
await
page
.
waitFor
(
3500
)
await
page
.
waitFor
(
3500
)
...
@@ -39,7 +41,9 @@ describe('getCurrentPages', () => {
...
@@ -39,7 +41,9 @@ describe('getCurrentPages', () => {
const
image2
=
await
program
.
screenshot
({
const
image2
=
await
program
.
screenshot
({
fullPage
:
true
fullPage
:
true
});
});
expect
(
image2
).
toSaveImageSnapshot
();
expect
(
image2
).
toSaveImageSnapshot
({
customSnapshotIdentifier
()
{
return
'
set-page-style-disable-pull-down-refresh-test-js-get-current-pages-page-style-after-set-page-style
'
}});
})
})
})
})
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录