Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
DCloud
uni-starter
提交
22c3df46
U
uni-starter
项目概览
DCloud
/
uni-starter
通知
4747
Star
231
Fork
211
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
6
列表
看板
标记
里程碑
合并请求
0
DevOps
流水线
流水线任务
计划
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
U
uni-starter
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
6
Issue
6
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
DevOps
DevOps
流水线
流水线任务
计划
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
流水线任务
提交
Issue看板
提交
22c3df46
编写于
11月 22, 2023
作者:
A
Anne_LXM
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
add imageSnapshot
上级
af22ff8a
变更
4
隐藏空白更改
内联
并排
Showing
4 changed file
with
120 addition
and
88 deletion
+120
-88
jest-setup.js
jest-setup.js
+19
-0
jest.config.js
jest.config.js
+3
-18
manifest.json
manifest.json
+70
-70
pages/pages.test.js
pages/pages.test.js
+28
-0
未找到文件。
jest-setup.js
0 → 100644
浏览文件 @
22c3df46
const
path
=
require
(
'
path
'
);
const
{
configureToMatchImageSnapshot
}
=
require
(
'
jest-image-snapshot
'
);
const
hbuilderx_version
=
process
.
env
.
HX_Version
const
uniTestPlatformInfo
=
process
.
env
.
uniTestPlatformInfo
?
process
.
env
.
uniTestPlatformInfo
.
replace
(
/
\s
/g
,
'
_
'
)
:
''
const
folderName
=
`__image_snapshots__/
${
hbuilderx_version
}
/__
${
uniTestPlatformInfo
}
__`
const
baseFolderName
=
`__image_snapshots__/base/__
${
uniTestPlatformInfo
}
__`
expect
.
extend
({
toMatchImageSnapshot
:
configureToMatchImageSnapshot
({
customSnapshotIdentifier
(
args
)
{
return
args
.
currentTestName
.
replace
(
/
\/
/g
,
'
-
'
).
replace
(
'
'
,
'
-
'
);
},
customSnapshotsDir
:
path
.
join
(
__dirname
,
baseFolderName
),
customDiffDir
:
path
.
join
(
__dirname
,
`
${
folderName
}
/`
,
'
diff
'
),
}),
});
\ No newline at end of file
jest.config.js
浏览文件 @
22c3df46
const
path
=
require
(
'
path
'
);
module
.
exports
=
{
testTimeout
:
4
0000
,
testTimeout
:
2
0000
,
reporters
:
[
'
default
'
],
watchPathIgnorePatterns
:
[
'
/node_modules/
'
,
'
/dist/
'
,
'
/.git/
'
],
moduleFileExtensions
:
[
'
js
'
,
'
json
'
],
rootDir
:
__dirname
,
/* testEnvironmentOptions: {
compile: true,
"app-plus": { // 需要安装 HBuilderX
android: {
// appid: "", //配置manifest.json中的appid
// package: "", //Android包名
// executablePath: "D:/xm/online-code/uni-starter/unpackage/debug/android_debug.apk" ,// 自定义调试基座包路径
executablePath: "HBuilderX/plugins/launcher/base/android_base.apk" ,// apk 目录
},
ios: {
// uuid 必须配置,目前仅支持模拟器,可以(xcrun simctl list)查看要使用的模拟器 uuid
id: "",
executablePath: "HBuilderX/plugins/launcher/base/Pandora_simulator.app" // ipa 目录
}
}
}, */
testMatch
:
[
"
<rootDir>/pages/**/*test.[jt]s?(x)
"
,
"
<rootDir>/uni_modules/uni-id-pages/**/*test.[jt]s?(x)
"
],
testPathIgnorePatterns
:
[
'
/node_modules/
'
],
testSequencer
:
path
.
join
(
__dirname
,
"
testSequencer.js
"
)
testSequencer
:
path
.
join
(
__dirname
,
"
testSequencer.js
"
),
setupFilesAfterEnv
:
[
'
<rootDir>/jest-setup.js
'
]
}
manifest.json
浏览文件 @
22c3df46
{
"name"
:
"uni-starter"
,
"appid"
:
"__UNI__8E9C31E"
,
"description"
:
"云端一体应用快速开发基本项目模版"
,
"versionName"
:
"1.0.0"
,
"versionCode"
:
"100"
,
"transformPx"
:
false
,
"app-plus"
:
{
"usingComponents"
:
true
,
"nvueStyleCompiler"
:
"uni-app"
,
"compilerVersion"
:
3
,
"splashscreen"
:
{
"alwaysShowBeforeRender"
:
true
,
"waiting"
:
true
,
"autoclose"
:
true
,
"delay"
:
0
},
"modules"
:
{},
"distribute"
:
{
"android"
:
{
"permissions"
:
[
"<uses-permission android:name=
\"
android.permission.CHANGE_NETWORK_STATE
\"
/>"
,
"<uses-permission android:name=
\"
android.permission.MOUNT_UNMOUNT_FILESYSTEMS
\"
/>"
,
"<uses-permission android:name=
\"
android.permission.VIBRATE
\"
/>"
,
"<uses-permission android:name=
\"
android.permission.READ_LOGS
\"
/>"
,
"<uses-permission android:name=
\"
android.permission.ACCESS_WIFI_STATE
\"
/>"
,
"<uses-feature android:name=
\"
android.hardware.camera.autofocus
\"
/>"
,
"<uses-permission android:name=
\"
android.permission.ACCESS_NETWORK_STATE
\"
/>"
,
"<uses-permission android:name=
\"
android.permission.CAMERA
\"
/>"
,
"<uses-permission android:name=
\"
android.permission.GET_ACCOUNTS
\"
/>"
,
"<uses-permission android:name=
\"
android.permission.READ_PHONE_STATE
\"
/>"
,
"<uses-permission android:name=
\"
android.permission.CHANGE_WIFI_STATE
\"
/>"
,
"<uses-permission android:name=
\"
android.permission.WAKE_LOCK
\"
/>"
,
"<uses-permission android:name=
\"
android.permission.FLASHLIGHT
\"
/>"
,
"<uses-feature android:name=
\"
android.hardware.camera
\"
/>"
,
"<uses-permission android:name=
\"
android.permission.WRITE_SETTINGS
\"
/>"
]
},
"ios"
:
{},
"sdkConfigs"
:
{
"push"
:
{
"unipush"
:
null
}
}
}
},
"quickapp"
:
{},
"mp-weixin"
:
{
"appid"
:
""
,
"setting"
:
{
"urlCheck"
:
false
},
"usingComponents"
:
true
,
"optimization"
:
{
"subPackages"
:
true
}
},
"mp-alipay"
:
{
"usingComponents"
:
true
},
"mp-baidu"
:
{
"usingComponents"
:
true
},
"mp-toutiao"
:
{
"usingComponents"
:
true
},
"uniStatistics"
:
{
"enable"
:
false
},
"vueVersion"
:
"2"
}
\ No newline at end of file
"name"
:
"uni-starter"
,
"appid"
:
"__UNI__8E9C31E"
,
"description"
:
"云端一体应用快速开发基本项目模版"
,
"versionName"
:
"1.0.0"
,
"versionCode"
:
"100"
,
"transformPx"
:
false
,
"app-plus"
:
{
"usingComponents"
:
true
,
"nvueStyleCompiler"
:
"uni-app"
,
"compilerVersion"
:
3
,
"splashscreen"
:
{
"alwaysShowBeforeRender"
:
true
,
"waiting"
:
true
,
"autoclose"
:
true
,
"delay"
:
0
},
"modules"
:
{},
"distribute"
:
{
"android"
:
{
"permissions"
:
[
"<uses-permission android:name=
\"
android.permission.CHANGE_NETWORK_STATE
\"
/>"
,
"<uses-permission android:name=
\"
android.permission.MOUNT_UNMOUNT_FILESYSTEMS
\"
/>"
,
"<uses-permission android:name=
\"
android.permission.VIBRATE
\"
/>"
,
"<uses-permission android:name=
\"
android.permission.READ_LOGS
\"
/>"
,
"<uses-permission android:name=
\"
android.permission.ACCESS_WIFI_STATE
\"
/>"
,
"<uses-feature android:name=
\"
android.hardware.camera.autofocus
\"
/>"
,
"<uses-permission android:name=
\"
android.permission.ACCESS_NETWORK_STATE
\"
/>"
,
"<uses-permission android:name=
\"
android.permission.CAMERA
\"
/>"
,
"<uses-permission android:name=
\"
android.permission.GET_ACCOUNTS
\"
/>"
,
"<uses-permission android:name=
\"
android.permission.READ_PHONE_STATE
\"
/>"
,
"<uses-permission android:name=
\"
android.permission.CHANGE_WIFI_STATE
\"
/>"
,
"<uses-permission android:name=
\"
android.permission.WAKE_LOCK
\"
/>"
,
"<uses-permission android:name=
\"
android.permission.FLASHLIGHT
\"
/>"
,
"<uses-feature android:name=
\"
android.hardware.camera
\"
/>"
,
"<uses-permission android:name=
\"
android.permission.WRITE_SETTINGS
\"
/>"
]
},
"ios"
:
{},
"sdkConfigs"
:
{
"push"
:
{
"unipush"
:
null
}
}
}
},
"quickapp"
:
{},
"mp-weixin"
:
{
"appid"
:
"wxf72d316417b6767f"
,
"setting"
:
{
"urlCheck"
:
false
},
"usingComponents"
:
true
,
"optimization"
:
{
"subPackages"
:
true
}
},
"mp-alipay"
:
{
"usingComponents"
:
true
},
"mp-baidu"
:
{
"usingComponents"
:
true
},
"mp-toutiao"
:
{
"usingComponents"
:
true
},
"uniStatistics"
:
{
"enable"
:
false
},
"vueVersion"
:
"2"
}
pages/pages.test.js
0 → 100644
浏览文件 @
22c3df46
let
pageIndex
=
0
const
pages
=
[
'
/pages/ucenter/settings/settings
'
,
'
/pages/ucenter/ucenter
'
,
'
/uni_modules/uni-id-pages/pages/login/login-withoutpwd
'
]
let
page
;
describe
(
'
page screenshot test
'
,
()
=>
{
beforeAll
(
async
()
=>
{
console
.
log
(
"
page screenshot test start
"
);
});
beforeEach
(
async
()
=>
{
page
=
await
program
.
reLaunch
(
pages
[
pageIndex
]);
await
page
.
waitFor
(
1000
);
});
afterEach
(()
=>
{
pageIndex
++
;
});
afterAll
(()
=>
{
console
.
log
(
"
page screenshot test finish
"
);
});
test
.
each
(
pages
)(
'
%s
'
,
async
()
=>
{
const
image
=
await
program
.
screenshot
();
expect
(
image
).
toMatchImageSnapshot
();
await
page
.
waitFor
(
500
);
})
})
\ No newline at end of file
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录