Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
DCloud
uni-starter
提交
27c638bd
U
uni-starter
项目概览
DCloud
/
uni-starter
通知
4691
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看板
提交
27c638bd
编写于
3月 13, 2024
作者:
A
Anne_LXM
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
update test
上级
5a08267e
变更
8
隐藏空白更改
内联
并排
Showing
8 changed file
with
79 addition
and
84 deletion
+79
-84
pages/grid/grid.test.js
pages/grid/grid.test.js
+2
-3
pages/list/list.nvue
pages/list/list.nvue
+1
-1
pages/list/list.test.js
pages/list/list.test.js
+0
-2
pages/ucenter/about/about.test.js
pages/ucenter/about/about.test.js
+14
-10
pages/ucenter/ucenter.test.js
pages/ucenter/ucenter.test.js
+30
-32
uni_modules/uni-id-pages/pages/login/login-withpwd.test.js
uni_modules/uni-id-pages/pages/login/login-withpwd.test.js
+1
-2
uni_modules/uni-id-pages/pages/register/register.test.js
uni_modules/uni-id-pages/pages/register/register.test.js
+1
-1
uni_modules/uni-id-pages/pages/userinfo/userinfo.test.js
uni_modules/uni-id-pages/pages/userinfo/userinfo.test.js
+30
-33
未找到文件。
pages/grid/grid.test.js
浏览文件 @
27c638bd
...
...
@@ -9,14 +9,13 @@ describe('grid', () => {
})
it
(
'
检测宫格
'
,
async
()
=>
{
hasLogin
=
await
page
.
data
(
'
hasLogin
'
)
console
.
log
(
"
hasLogin
"
,
hasLogin
)
let
gridList
=
await
page
.
data
(
'
gridList
'
)
console
.
log
(
"
gridList
"
,
gridList
)
console
.
log
(
"
gridList
"
,
hasLogin
,
gridList
.
length
)
expect
(
gridList
.
length
).
toBe
(
9
)
})
it
(
'
点击宫格
'
,
async
()
=>
{
const
perPage
=
await
page
.
$$
(
'
.grid-item-box
'
)
console
.
log
(
"
perPage
"
,
perPage
)
console
.
log
(
"
perPage
"
,
perPage
.
length
)
for
(
var
i
=
0
;
i
<
perPage
.
length
;
i
++
)
{
await
perPage
[
i
].
tap
()
await
page
.
waitFor
(
300
)
...
...
pages/list/list.nvue
浏览文件 @
27c638bd
...
...
@@ -127,7 +127,7 @@
// });
//默认h5端不获取定位
// #ifndef H5
if(isTest){
if(
this.
isTest){
let location = await gps.getLocation({
geocode: true
})
...
...
pages/list/list.test.js
浏览文件 @
27c638bd
...
...
@@ -11,9 +11,7 @@ describe('list', () => {
beforeAll
(
async
()
=>
{
page
=
await
program
.
switchTab
(
PAGE_PATH
)
await
page
.
waitFor
(
'
view
'
)
console
.
log
(
'
page:
'
,
page
);
await
page
.
setData
({
'
isTest
'
:
true
})
console
.
log
(
'
isTest
'
,
await
page
.
data
({
'
isTest
'
:
true
}));
})
it
(
'
检测标题
'
,
async
()
=>
{
expect
.
assertions
(
1
);
...
...
pages/ucenter/about/about.test.js
浏览文件 @
27c638bd
...
...
@@ -3,16 +3,20 @@
const
PAGE_PATH
=
'
/pages/ucenter/about/about
'
describe
(
'
about
'
,
()
=>
{
let
page
,
isWX
;
beforeAll
(
async
()
=>
{
isWX
=
process
.
env
.
UNI_PLATFORM
===
"
mp-weixin
"
if
(
!
isWX
){
isWX
=
process
.
env
.
UNI_PLATFORM
===
"
mp-weixin
"
if
(
isWX
){
it
(
'
微信平台不支持
'
,
async
()
=>
{
expect
(
1
).
toBe
(
1
)
})
return
}
else
{
beforeAll
(
async
()
=>
{
page
=
await
program
.
reLaunch
(
PAGE_PATH
)
await
page
.
waitFor
(
'
view
'
)
}
})
it
(
'
appName
'
,
async
()
=>
{
if
(
isWX
)
return
expect
.
assertions
(
1
);
expect
((
await
page
.
data
(
'
about
'
)).
appName
).
toBe
(
'
uni-starter
'
)
})
})
it
(
'
appName
'
,
async
()
=>
{
expect
.
assertions
(
1
);
expect
((
await
page
.
data
(
'
about
'
)).
appName
).
toBe
(
'
uni-starter
'
)
})
}
});
pages/ucenter/ucenter.test.js
浏览文件 @
27c638bd
...
...
@@ -2,14 +2,12 @@ jest.setTimeout(20000);
const
PAGE_PATH
=
'
/pages/ucenter/ucenter
'
describe
(
'
ucenter
'
,
()
=>
{
let
page
,
uniToken
,
platform
;
platform
=
process
.
env
.
UNI_PLATFORM
beforeAll
(
async
()
=>
{
try
{
page
=
await
program
.
switchTab
(
PAGE_PATH
)
await
page
.
waitFor
(
'
view
'
)
console
.
log
(
'
page:
'
,
page
);
console
.
log
(
'
pageStack:
'
,
await
program
.
pageStack
());
uniToken
=
await
program
.
callUniMethod
(
'
getStorageSync
'
,
'
uni_id_token
'
)
platform
=
process
.
env
.
UNI_PLATFORM
console
.
log
(
"
uniToken:
"
,
platform
,
uniToken
);
}
catch
(
err
){
console
.
log
(
'
err:
'
,
err
);
...
...
@@ -22,38 +20,38 @@ describe('ucenter', () => {
})
it
(
'
列表
'
,
async
()
=>
{
const
getUcenterList
=
await
page
.
data
(
'
ucenterList
'
)
if
(
platform
.
startsWith
(
"
app
"
)
||
platform
===
"
h5
"
){
expect
(
getUcenterList
.
length
).
toBe
(
3
)
}
else
if
(
platform
===
"
mp-weixin
"
){
expect
(
getUcenterList
.
length
).
toBe
(
2
)
}
})
it
(
'
普通签到
'
,
async
()
=>
{
if
(
!
uniToken
)
return
;
if
(
platform
.
startsWith
(
"
app
"
)){
await
page
.
callMethod
(
'
signInByAd
'
)
await
page
.
waitFor
(
1000
)
await
page
.
callMethod
(
'
share
'
)
// await program.screenshot({
// path: "static/screenshot/sign-app.png"
// })
if
(
platform
===
"
mp-weixin
"
){
expect
(
getUcenterList
).
toHaveLength
(
2
);
}
else
{
await
page
.
callMethod
(
'
signIn
'
)
}
})
it
(
'
我的积分
'
,
async
()
=>
{
if
(
!
uniToken
)
return
;
const
getScoreRes
=
await
page
.
callMethod
(
'
getScore
'
)
console
.
log
(
'
getScoreRes:
'
,
getScoreRes
);
await
page
.
waitFor
(
1000
)
if
(
getScoreRes
.
score
)
{
expect
.
assertions
(
2
);
expect
(
getScoreRes
.
score
).
not
.
toBeUndefined
();
expect
(
getScoreRes
.
balance
).
toBeGreaterThanOrEqual
(
getScoreRes
.
score
);
}
else
{
console
.
log
(
"
签到失败
"
);
expect
(
getUcenterList
).
toHaveLength
(
3
);
}
})
if
(
uniToken
){
it
(
'
普通签到
'
,
async
()
=>
{
if
(
platform
.
startsWith
(
"
app
"
)){
await
page
.
callMethod
(
'
signInByAd
'
)
await
page
.
waitFor
(
1000
)
await
page
.
callMethod
(
'
share
'
)
// await program.screenshot({
// path: "static/screenshot/sign-app.png"
// })
}
else
{
await
page
.
callMethod
(
'
signIn
'
)
}
})
it
(
'
我的积分
'
,
async
()
=>
{
const
getScoreRes
=
await
page
.
callMethod
(
'
getScore
'
)
console
.
log
(
'
getScoreRes:
'
,
getScoreRes
);
await
page
.
waitFor
(
1000
)
if
(
getScoreRes
.
score
)
{
expect
.
assertions
(
2
);
expect
(
getScoreRes
.
score
).
not
.
toBeUndefined
();
expect
(
getScoreRes
.
balance
).
toBeGreaterThanOrEqual
(
getScoreRes
.
score
);
}
else
{
console
.
log
(
"
签到失败
"
);
}
})
}
// it('screenshot',async()=>{
// await program.screenshot({
// path: "static/screenshot/ucenter.png"
...
...
uni_modules/uni-id-pages/pages/login/login-withpwd.test.js
浏览文件 @
27c638bd
...
...
@@ -24,7 +24,7 @@ describe('login-withpwd', () => {
const
resLogin
=
await
page
.
callMethod
(
'
pwdLogin
'
)
console
.
log
(
"
resLogin:
"
,
resLogin
);
expect
.
assertions
(
1
);
switch
(
resLogin
.
errCode
){
case
0
:
expect
(
resLogin
.
uid
).
toHaveLength
(
24
);
...
...
@@ -80,7 +80,6 @@ describe('login-withpwd', () => {
console
.
log
(
await
program
.
currentPage
());
break
;
}
console
.
log
(
'
login-end
'
)
await
page
.
waitFor
(
300
)
})
...
...
uni_modules/uni-id-pages/pages/register/register.test.js
浏览文件 @
27c638bd
...
...
@@ -20,7 +20,7 @@ describe('register', () => {
})
const
resLogin
=
await
page
.
callMethod
(
'
submit
'
)
console
.
log
(
"
resLogin:
"
,
resLogin
);
expect
.
assertions
(
1
);
switch
(
resLogin
.
errCode
)
{
case
0
:
console
.
log
(
'
注册成功
'
)
...
...
uni_modules/uni-id-pages/pages/userinfo/userinfo.test.js
浏览文件 @
27c638bd
// uni-app自动化测试教程: uni-app自动化测试教程: https://uniapp.dcloud.io/collocation/auto/hbuilderx-extension/index
const
PAGE_PATH
=
'
/uni_modules/uni-id-pages/pages/userinfo/userinfo
'
describe
(
'
userinfo
'
,
()
=>
{
describe
(
'
userinfo
'
,()
=>
{
let
page
,
uniToken
;
beforeAll
(
async
()
=>
{
page
=
await
program
.
navigateTo
(
PAGE_PATH
)
await
page
.
waitFor
(
"
view
"
)
console
.
log
(
"
page
:
"
,
page
);
console
.
log
(
"
page
Stack:
"
,
await
program
.
pageStack
()
);
uniToken
=
await
program
.
callUniMethod
(
'
getStorageSync
'
,
'
uni_id_token
'
)
console
.
log
(
"
uniToken:
"
,
uniToken
);
console
.
log
(
"
pageStack:
"
,
await
program
.
pageStack
());
});
it
(
"
昵称
"
,
async
()
=>
{
if
(
!
uniToken
)
return
;
const
nickname
=
"
数字天堂DCloud
"
+
Math
.
round
(
Math
.
random
()
*
10
);
await
page
.
waitFor
(
300
)
await
page
.
callMethod
(
"
setNickname
"
,
nickname
)
})
it
(
"
头像
"
,
async
()
=>
{
if
(
!
uniToken
)
return
;
const
imgs
=
[
"
https://vkceyugu.cdn.bspapp.com/VKCEYUGU-52b18b34-3a3e-4861-89a0-c362c7634787/5105c383-8d83-4f40-938e-7c32c5983f8d.png
"
,
"
https://vkceyugu.cdn.bspapp.com/VKCEYUGU-52b18b34-3a3e-4861-89a0-c362c7634787/61869c72-3117-4ea4-8d6d-ebb67617c7d9.jpg
"
,
"
https://vkceyugu.cdn.bspapp.com/VKCEYUGU-52b18b34-3a3e-4861-89a0-c362c7634787/558cde0a-b514-4de7-8c7d-1d6b733f9440.png
"
]
const
avatar_file
=
{
url
:
imgs
[
Math
.
floor
(
Math
.
random
()
*
imgs
.
length
)]
}
console
.
log
(
"
avatar_file:
"
,
avatar_file
);
console
.
log
(
"
process.env.UNI_PLATFORM:
"
,
process
.
env
.
UNI_PLATFORM
);
// if (process.env.UNI_PLATFORM != "mp-weixin") {
// const avatarCom = await page.$('.avatar')
// console.log("avatarCom: ",avatarCom);
// const elBox = await avatarCom.$('.box')
// console.log("elBox: ",elBox);
// // const elBox = await page.$('.box')
// await elBox.callMethod('setAvatarFile',avatar_file)
// await elBox.waitFor(500)
// }
})
if
(
uniToken
){
it
(
"
昵称
"
,
async
()
=>
{
const
nickname
=
"
数字天堂DCloud
"
+
Math
.
round
(
Math
.
random
()
*
10
);
await
page
.
waitFor
(
300
)
await
page
.
callMethod
(
"
setNickname
"
,
nickname
)
})
it
(
"
头像
"
,
async
()
=>
{
const
imgs
=
[
"
https://vkceyugu.cdn.bspapp.com/VKCEYUGU-52b18b34-3a3e-4861-89a0-c362c7634787/5105c383-8d83-4f40-938e-7c32c5983f8d.png
"
,
"
https://vkceyugu.cdn.bspapp.com/VKCEYUGU-52b18b34-3a3e-4861-89a0-c362c7634787/61869c72-3117-4ea4-8d6d-ebb67617c7d9.jpg
"
,
"
https://vkceyugu.cdn.bspapp.com/VKCEYUGU-52b18b34-3a3e-4861-89a0-c362c7634787/558cde0a-b514-4de7-8c7d-1d6b733f9440.png
"
]
const
avatar_file
=
{
url
:
imgs
[
Math
.
floor
(
Math
.
random
()
*
imgs
.
length
)]
}
console
.
log
(
"
avatar_file:
"
,
avatar_file
);
console
.
log
(
"
process.env.UNI_PLATFORM:
"
,
process
.
env
.
UNI_PLATFORM
);
// if (process.env.UNI_PLATFORM != "mp-weixin") {
// const avatarCom = await page.$('.avatar')
// console.log("avatarCom: ",avatarCom);
// const elBox = await avatarCom.$('.box')
// console.log("elBox: ",elBox);
// // const elBox = await page.$('.box')
// await elBox.callMethod('setAvatarFile',avatar_file)
// await elBox.waitFor(500)
// }
})
}
it
(
"
screenshot
"
,
async
()
=>
{
if
(
!
uniToken
)
return
;
await
program
.
screenshot
({
path
:
"
static/screenshot/userinfo.png
"
// 默认项目根目录
})
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录