Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
DCloud
uni-starter
提交
4ace9115
U
uni-starter
项目概览
DCloud
/
uni-starter
通知
4718
Star
230
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看板
提交
4ace9115
编写于
4月 29, 2024
作者:
Anne_LXM
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
test userinfo.test.js/ucenter.test.js
上级
1d4140d0
变更
8
隐藏空白更改
内联
并排
Showing
8 changed file
with
57 addition
and
66 deletion
+57
-66
pages/grid/grid.test.js
pages/grid/grid.test.js
+1
-2
pages/list/list.nvue
pages/list/list.nvue
+1
-1
pages/list/list.test.js
pages/list/list.test.js
+27
-28
pages/list/search/search.test.js
pages/list/search/search.test.js
+0
-3
pages/ucenter/settings/settings.test.js
pages/ucenter/settings/settings.test.js
+0
-1
pages/ucenter/ucenter.test.js
pages/ucenter/ucenter.test.js
+9
-16
uni_modules/uni-id-pages/pages/userinfo/userinfo.test.js
uni_modules/uni-id-pages/pages/userinfo/userinfo.test.js
+15
-11
uni_modules/uni-id-pages/pages/userinfo/userinfo.vue
uni_modules/uni-id-pages/pages/userinfo/userinfo.vue
+4
-4
未找到文件。
pages/grid/grid.test.js
浏览文件 @
4ace9115
...
...
@@ -6,14 +6,13 @@ describe('grid', () => {
let
page
,
hasLogin
;
beforeAll
(
async
()
=>
{
page
=
await
program
.
switchTab
(
PAGE_PATH
)
console
.
log
(
'
page
'
,
page
)
await
page
.
waitFor
(
'
view
'
)
})
it
(
'
检测宫格
'
,
async
()
=>
{
await
page
.
waitFor
(
2000
)
hasLogin
=
await
page
.
data
(
'
hasLogin
'
)
let
gridList
=
await
page
.
data
(
'
gridList
'
)
console
.
log
(
"
gridList
"
,
hasLogin
,
gridList
.
length
)
console
.
log
(
"
gridList
"
,
gridList
.
length
,
hasLogin
)
expect
(
gridList
.
length
).
toBe
(
9
)
})
it
(
'
点击宫格
'
,
async
()
=>
{
...
...
pages/list/list.nvue
浏览文件 @
4ace9115
...
...
@@ -93,7 +93,7 @@
showRefresh: false,
listHight: 0,
dataList:{},
isTest:
fals
e
isTest:
tru
e
}
},
watch: {
...
...
pages/list/list.test.js
浏览文件 @
4ace9115
const
PAGE_PATH
=
'
/pages/list/list
'
describe
(
'
list
'
,
()
=>
{
let
page
,
containsVite
,
isApp
;
containsVite
=
process
.
env
.
UNI_CLI_PATH
.
includes
(
'
uniapp-cli-vite
'
)
isApp
=
process
.
env
.
UNI_PLATFORM
.
includes
(
'
app
'
)
if
(
containsVite
&&
isApp
){
it
(
'
vue3
'
,
async
()
=>
{
expect
(
1
).
toBe
(
1
)
})
return
}
beforeAll
(
async
()
=>
{
page
=
await
program
.
switchTab
(
PAGE_PATH
)
console
.
log
(
'
page
'
,
page
);
await
page
.
waitFor
(
'
view
'
)
await
page
.
setData
({
'
isTest
'
:
true
})
})
it
(
'
检测标题
'
,
async
()
=>
{
expect
.
assertions
(
1
);
await
page
.
waitFor
(
5000
)
const
getTitle
=
await
page
.
data
(
'
dataList
'
)
console
.
log
(
'
getTitle:
'
,
getTitle
);
expect
(
getTitle
.
title
).
toBe
(
'
阿里小程序IDE官方内嵌uni-app,为开发者提供多端开发服务
'
)
})
it
(
'
点击搜索跳转
'
,
async
()
=>
{
await
page
.
callMethod
(
'
searchClick
'
)
await
page
.
waitFor
(
300
)
})
const
PAGE_PATH
=
'
/pages/list/list
'
describe
(
'
list
'
,
()
=>
{
let
page
,
containsVite
,
isApp
;
containsVite
=
process
.
env
.
UNI_CLI_PATH
.
includes
(
'
uniapp-cli-vite
'
)
isApp
=
process
.
env
.
UNI_PLATFORM
.
includes
(
'
app
'
)
if
(
containsVite
&&
isApp
)
{
it
(
'
vue3
'
,
async
()
=>
{
expect
(
1
).
toBe
(
1
)
})
return
}
beforeAll
(
async
()
=>
{
page
=
await
program
.
switchTab
(
PAGE_PATH
)
await
page
.
waitFor
(
'
view
'
)
await
page
.
setData
({
'
isTest
'
:
true
})
})
it
(
'
检测标题
'
,
async
()
=>
{
expect
.
assertions
(
1
);
await
page
.
waitFor
(
5000
)
const
getTitle
=
await
page
.
data
(
'
dataList
'
)
console
.
log
(
'
getTitle:
'
,
getTitle
);
expect
(
getTitle
.
title
).
toBe
(
'
阿里小程序IDE官方内嵌uni-app,为开发者提供多端开发服务
'
)
})
it
(
'
点击搜索跳转
'
,
async
()
=>
{
await
page
.
callMethod
(
'
searchClick
'
)
await
page
.
waitFor
(
300
)
})
})
\ No newline at end of file
pages/list/search/search.test.js
浏览文件 @
4ace9115
...
...
@@ -5,8 +5,6 @@ describe('search', () => {
let
page
,
containsVite
,
isApp
;
containsVite
=
process
.
env
.
UNI_CLI_PATH
.
includes
(
'
uniapp-cli-vite
'
)
isApp
=
process
.
env
.
UNI_PLATFORM
.
includes
(
'
app
'
)
console
.
log
(
'
uniTestPlatformInfo
'
,
process
.
env
.
uniTestPlatformInfo
)
console
.
log
((
containsVite
&&
isApp
)
,
process
.
env
.
uniTestPlatformInfo
==
'
ios_simulator 13.7
'
)
if
((
containsVite
&&
isApp
)
||
process
.
env
.
uniTestPlatformInfo
==
'
ios_simulator 13.7
'
)
{
it
(
'
app--vue3
'
,
async
()
=>
{
expect
(
1
).
toBe
(
1
)
...
...
@@ -15,7 +13,6 @@ describe('search', () => {
}
beforeAll
(
async
()
=>
{
page
=
await
program
.
reLaunch
(
PAGE_PATH
)
console
.
log
(
'
page
'
,
page
)
console
.
log
(
'
page
'
,
await
program
.
pageStack
())
await
page
.
waitFor
(
'
view
'
)
})
...
...
pages/ucenter/settings/settings.test.js
浏览文件 @
4ace9115
...
...
@@ -35,7 +35,6 @@ describe('settings', () => {
})
it
(
'
退出登录
'
,
async
()
=>
{
const
bottomEl
=
await
page
.
$
(
'
.bottom-back-text
'
)
console
.
log
(
'
bottom-back-text
'
,
bottomEl
,
await
bottomEl
.
text
())
expect
(
await
bottomEl
.
text
()).
toBe
(
'
退出登录
'
)
await
page
.
callMethod
(
'
changeLoginState
'
)
await
page
.
waitFor
(
1000
)
...
...
pages/ucenter/ucenter.test.js
浏览文件 @
4ace9115
...
...
@@ -3,8 +3,7 @@ const PAGE_PATH = '/pages/ucenter/ucenter'
describe
(
'
ucenter
'
,
()
=>
{
let
page
,
platform
,
hasLogin
;
platform
=
process
.
env
.
UNI_PLATFORM
console
.
log
(
'
uniTestPlatformInfo
'
,
process
.
env
.
uniTestPlatformInfo
,
process
.
env
.
uniTestPlatformInfo
==
'
ios_simulator 13.7
'
)
console
.
log
(
'
uniTestPlatformInfo
'
,
process
.
env
.
uniTestPlatformInfo
)
if
(
process
.
env
.
uniTestPlatformInfo
==
'
ios_simulator 13.7
'
)
{
it
(
'
ucenter-ios13.7
'
,
async
()
=>
{
expect
(
1
).
toBe
(
1
)
...
...
@@ -12,34 +11,28 @@ describe('ucenter', () => {
return
}
beforeAll
(
async
()
=>
{
try
{
page
=
await
program
.
switchTab
(
PAGE_PATH
)
await
page
.
waitFor
(
'
view
'
)
hasLogin
=
await
page
.
callMethod
(
'
hasLoginTest
'
)
console
.
log
(
"
登录状态
"
,
hasLogin
,
platform
)
}
catch
(
err
)
{
console
.
log
(
'
err:
'
,
err
);
page
=
await
program
.
switchTab
(
PAGE_PATH
)
await
page
.
waitFor
(
'
view
'
)
hasLogin
=
await
page
.
callMethod
(
'
hasLoginTest
'
)
console
.
log
(
"
登录状态
"
,
hasLogin
,
platform
)
if
(
!
hasLogin
)
{
console
.
log
(
'
hasLogin--err
'
)
return
}
})
it
(
'
宫格
'
,
async
()
=>
{
expect
.
assertions
(
1
);
const
getGrid
=
await
page
.
data
(
'
gridList
'
)
console
.
log
(
'
getGrid
'
,
getGrid
.
length
)
expect
(
getGrid
.
length
).
toBe
(
4
)
})
it
(
'
列表
'
,
async
()
=>
{
const
getUcenterList
=
await
page
.
data
(
'
ucenterList
'
)
console
.
log
(
'
getUcenterList
'
,
getUcenterList
.
length
)
if
(
platform
===
"
mp-weixin
"
)
{
expect
(
getUcenterList
.
length
).
toBe
(
2
);
}
else
{
expect
(
getUcenterList
.
length
).
toBe
(
3
);
}
})
if
(
!
hasLogin
)
{
console
.
log
(
'
hasLogin--err
'
)
return
}
})
it
(
'
普通签到
'
,
async
()
=>
{
if
(
platform
.
startsWith
(
"
app
"
))
{
await
page
.
callMethod
(
'
signInByAd
'
)
...
...
uni_modules/uni-id-pages/pages/userinfo/userinfo.test.js
浏览文件 @
4ace9115
...
...
@@ -2,7 +2,7 @@
const
PAGE_PATH
=
'
/uni_modules/uni-id-pages/pages/userinfo/userinfo
'
jest
.
setTimeout
(
30000
);
describe
(
'
userinfo
'
,
()
=>
{
let
page
,
hasLogin
;
let
page
,
userInfo
;
if
(
process
.
env
.
uniTestPlatformInfo
==
'
ios_simulator 13.7
'
)
{
it
(
'
userinfo-ios
'
,
async
()
=>
{
expect
(
1
).
toBe
(
1
)
...
...
@@ -12,18 +12,29 @@ describe('userinfo', () => {
beforeAll
(
async
()
=>
{
page
=
await
program
.
navigateTo
(
PAGE_PATH
)
await
page
.
waitFor
(
"
view
"
)
hasLogin
=
await
page
.
callMethod
(
'
hasLogin
Test
'
)
console
.
log
(
"
登录状态
"
,
hasLogin
)
if
(
!
hasLogin
)
{
userInfo
=
await
page
.
callMethod
(
'
userInfo
Test
'
)
console
.
log
(
"
userInfo---1
"
,
userInfo
)
if
(
!
userInfo
.
_id
)
{
console
.
log
(
"
未登录测试失败
"
)
return
}
});
it
(
"
昵称
"
,
async
()
=>
{
const
nickname
=
"
数字天堂DCloud
"
+
Math
.
round
(
Math
.
random
()
*
10
);
console
.
log
(
'
nickname
'
,
nickname
)
await
page
.
waitFor
(
300
)
await
page
.
callMethod
(
"
setNickname
"
,
nickname
)
await
page
.
waitFor
(
5000
)
userInfo
=
await
page
.
callMethod
(
'
userInfoTest
'
)
console
.
log
(
"
update--nickname---2
"
,
userInfo
.
nickname
)
expect
(
userInfo
.
nickname
).
toBe
(
nickname
)
})
// it("screenshot", async () => {
// await program.screenshot({
// path: "static/screenshot/userinfo.png" // 默认项目根目录
// })
// await page.waitFor(500)
// })
// it("头像", async () => {
// const imgs = [
// "https://vkceyugu.cdn.bspapp.com/VKCEYUGU-52b18b34-3a3e-4861-89a0-c362c7634787/5105c383-8d83-4f40-938e-7c32c5983f8d.png",
...
...
@@ -46,11 +57,4 @@ describe('userinfo', () => {
// await elBox.waitFor(500)
// }
// })
// it("screenshot", async () => {
// await program.screenshot({
// path: "static/screenshot/userinfo.png" // 默认项目根目录
// })
// await page.waitFor(500)
// })
});
\ No newline at end of file
uni_modules/uni-id-pages/pages/userinfo/userinfo.vue
浏览文件 @
4ace9115
...
...
@@ -87,10 +87,10 @@ const uniIdCo = uniCloud.importObject("uni-id-co")
this
.
hasPwd
=
res
.
isPasswordSet
},
methods
:
{
// 自动化测试专用
hasLoginTest
()
{
return
store
.
hasLogin
},
// 自动化测试专用
userInfoTest
()
{
return
store
.
userInfo
},
login
()
{
uni
.
navigateTo
({
url
:
'
/uni_modules/uni-id-pages/pages/login/login-withoutpwd
'
,
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录