Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
DCloud
uni-starter
提交
d9adfc53
U
uni-starter
项目概览
DCloud
/
uni-starter
通知
4684
Star
229
Fork
210
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
3
列表
看板
标记
里程碑
合并请求
0
DevOps
流水线
流水线任务
计划
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
U
uni-starter
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
3
Issue
3
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
DevOps
DevOps
流水线
流水线任务
计划
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
流水线任务
提交
Issue看板
提交
d9adfc53
编写于
5月 29, 2024
作者:
Anne_LXM
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
test:screenshot
上级
351f872b
变更
5
隐藏空白更改
内联
并排
Showing
5 changed file
with
14 addition
and
12 deletion
+14
-12
jest-setup.js
jest-setup.js
+10
-8
pages/pages.test.js
pages/pages.test.js
+1
-1
pages/ucenter/settings/settings.test.js
pages/ucenter/settings/settings.test.js
+1
-1
pages/ucenter/ucenter.test.js
pages/ucenter/ucenter.test.js
+1
-1
uni_modules/uni-id-pages/pages/userinfo/userinfo.test.js
uni_modules/uni-id-pages/pages/userinfo/userinfo.test.js
+1
-1
未找到文件。
jest-setup.js
浏览文件 @
d9adfc53
const
path
=
require
(
"
path
"
);
const
path
=
require
(
"
path
"
);
const
fs
=
require
(
"
fs
"
);
const
fs
=
require
(
"
fs
"
);
const
{
configureToMatchImageSnapshot
}
=
require
(
'
jest-image-snapshot
'
);
const
{
configureToMatchImageSnapshot
}
=
require
(
'
jest-image-snapshot
'
);
let
saveImageSnapshotDir
=
process
.
env
.
saveImageSnapshotDir
||
path
.
join
(
__dirname
,
'
__snapshot__
'
);
let
saveImageSnapshotDir
=
process
.
env
.
saveImageSnapshotDir
||
path
.
join
(
__dirname
,
'
__snapshot__
'
);
expect
.
extend
({
expect
.
extend
({
//
toMatchImageSnapshot: configureToMatchImageSnapshot({
toMatchImageSnapshot
:
configureToMatchImageSnapshot
({
//
customSnapshotIdentifier(args) {
customSnapshotIdentifier
(
args
)
{
//
return args.currentTestName.replace(/\//g, "-").replace(" ", "-");
return
args
.
currentTestName
.
replace
(
/
\/
/g
,
"
-
"
).
replace
(
"
"
,
"
-
"
);
//
},
},
//
customSnapshotsDir: process.env.saveImageSnapshotDir,
customSnapshotsDir
:
process
.
env
.
saveImageSnapshotDir
,
//
customDiffDir: path.join(saveImageSnapshotDir, "diff"),
customDiffDir
:
path
.
join
(
saveImageSnapshotDir
,
"
diff
"
),
//
}),
}),
toSaveSnapshot
,
toSaveSnapshot
,
toSaveImageSnapshot
,
toSaveImageSnapshot
,
});
});
...
...
pages/pages.test.js
浏览文件 @
d9adfc53
...
@@ -26,7 +26,7 @@ describe('page screenshot test', () => {
...
@@ -26,7 +26,7 @@ describe('page screenshot test', () => {
console
.
log
(
"
page screenshot test finish
"
);
console
.
log
(
"
page screenshot test finish
"
);
});
});
test
.
each
(
pages
)(
'
%s
'
,
async
()
=>
{
test
.
each
(
pages
)(
'
%s
'
,
async
()
=>
{
const
image
=
await
program
.
screenshot
(
{
deviceShot
:
true
,
fullPage
:
true
}
);
const
image
=
await
program
.
screenshot
();
expect
(
image
).
toSaveImageSnapshot
();
expect
(
image
).
toSaveImageSnapshot
();
await
page
.
waitFor
(
500
);
await
page
.
waitFor
(
500
);
})
})
...
...
pages/ucenter/settings/settings.test.js
浏览文件 @
d9adfc53
...
@@ -32,7 +32,7 @@ describe('settings', () => {
...
@@ -32,7 +32,7 @@ describe('settings', () => {
}
}
})
})
it
(
'
screenshot
'
,
async
()
=>
{
it
(
'
screenshot
'
,
async
()
=>
{
const
image
=
await
program
.
screenshot
(
{
deviceShot
:
true
,
fullPage
:
true
}
);
const
image
=
await
program
.
screenshot
();
expect
(
image
).
toSaveImageSnapshot
();
expect
(
image
).
toSaveImageSnapshot
();
await
page
.
waitFor
(
500
);
await
page
.
waitFor
(
500
);
})
})
...
...
pages/ucenter/ucenter.test.js
浏览文件 @
d9adfc53
...
@@ -57,7 +57,7 @@ describe('ucenter', () => {
...
@@ -57,7 +57,7 @@ describe('ucenter', () => {
}
}
})
})
it
(
'
screenshot
'
,
async
()
=>
{
it
(
'
screenshot
'
,
async
()
=>
{
const
image
=
await
program
.
screenshot
(
{
deviceShot
:
true
,
fullPage
:
true
}
);
const
image
=
await
program
.
screenshot
();
expect
(
image
).
toSaveImageSnapshot
();
expect
(
image
).
toSaveImageSnapshot
();
await
page
.
waitFor
(
500
);
await
page
.
waitFor
(
500
);
})
})
...
...
uni_modules/uni-id-pages/pages/userinfo/userinfo.test.js
浏览文件 @
d9adfc53
...
@@ -30,7 +30,7 @@ describe('userinfo', () => {
...
@@ -30,7 +30,7 @@ describe('userinfo', () => {
expect
(
userInfo
.
nickname
).
toBe
(
nickname
)
expect
(
userInfo
.
nickname
).
toBe
(
nickname
)
})
})
it
(
'
screenshot
'
,
async
()
=>
{
it
(
'
screenshot
'
,
async
()
=>
{
const
image
=
await
program
.
screenshot
(
{
deviceShot
:
true
,
fullPage
:
true
}
);
const
image
=
await
program
.
screenshot
();
expect
(
image
).
toSaveImageSnapshot
();
expect
(
image
).
toSaveImageSnapshot
();
await
page
.
waitFor
(
500
);
await
page
.
waitFor
(
500
);
})
})
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录