Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
DCloud
hello-uniCloud
提交
e691801a
H
hello-uniCloud
项目概览
DCloud
/
hello-uniCloud
通知
294
Star
3
Fork
2
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
DevOps
流水线
流水线任务
计划
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
H
hello-uniCloud
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
DevOps
DevOps
流水线
流水线任务
计划
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
流水线任务
提交
Issue看板
提交
e691801a
编写于
11月 27, 2023
作者:
A
Anne_LXM
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
update test
上级
fbfcb7fc
变更
14
隐藏空白更改
内联
并排
Showing
14 changed file
with
83 addition
and
244 deletion
+83
-244
pages/clientDB/clientDB.test.js
pages/clientDB/clientDB.test.js
+2
-13
pages/clientDB/demo/demo.test.js
pages/clientDB/demo/demo.test.js
+3
-4
pages/clientDB/permission-demo/permission-demo.test.js
pages/clientDB/permission-demo/permission-demo.test.js
+2
-3
pages/clientDB/permission-demo/readme.test.js
pages/clientDB/permission-demo/readme.test.js
+2
-99
pages/clientDB/permission-field-simple/permission-field-simple.test.js
...B/permission-field-simple/permission-field-simple.test.js
+2
-3
pages/clientDB/permission-table-compound/permission-table-compound.test.js
...rmission-table-compound/permission-table-compound.test.js
+6
-6
pages/clientDB/permission-table-simple/permission-table-simple.test.js
...B/permission-table-simple/permission-table-simple.test.js
+46
-52
pages/clientDB/unicloud-db-demo/unicloud-db-demo.test.js
pages/clientDB/unicloud-db-demo/unicloud-db-demo.test.js
+11
-32
pages/clientDB/unicloud-db-demo/unicloud-db-demo.vue
pages/clientDB/unicloud-db-demo/unicloud-db-demo.vue
+4
-2
pages/cloudObject/cloudObject.test.js
pages/cloudObject/cloudObject.test.js
+1
-5
pages/storage/storage.test.js
pages/storage/storage.test.js
+0
-4
pages/user-info/add.test.js
pages/user-info/add.test.js
+1
-12
pages/user-info/add.vue
pages/user-info/add.vue
+1
-3
pages/validate-demo/add.test.js
pages/validate-demo/add.test.js
+2
-6
未找到文件。
pages/clientDB/clientDB.test.js
浏览文件 @
e691801a
...
@@ -4,24 +4,13 @@ describe('pages/clientDB/clientDB.vue', () => {
...
@@ -4,24 +4,13 @@ describe('pages/clientDB/clientDB.vue', () => {
// 重新reLaunch至首页,并获取首页page对象(其中 program 是uni-automator自动注入的全局对象)
// 重新reLaunch至首页,并获取首页page对象(其中 program 是uni-automator自动注入的全局对象)
page
=
await
program
.
switchTab
(
'
/pages/clientDB/clientDB
'
)
page
=
await
program
.
switchTab
(
'
/pages/clientDB/clientDB
'
)
await
page
.
waitFor
(
'
view
'
)
await
page
.
waitFor
(
'
view
'
)
page
=
await
program
.
currentPage
()
//
page = await program.currentPage()
})
})
it
(
'
当前页面-clientDB
'
,
async
()
=>
{
it
(
'
当前页面-clientDB
'
,
async
()
=>
{
// await page.waitFor(1000)
//expect.assertions(2);
//expect.assertions(2);
console
.
log
(
'
await page.path:
'
,
await
page
.
path
);
expect
(
await
page
.
path
).
toBe
(
'
pages/clientDB/clientDB
'
)
expect
(
await
page
.
path
).
toBe
(
'
pages/clientDB/clientDB
'
)
await
page
.
waitFor
(
300
)
await
page
.
waitFor
(
300
)
const
list
=
await
page
.
$$
(
'
.item
'
)
const
list
=
await
page
.
$$
(
'
.item
'
)
// console.log("list: ",list);
expect
(
list
.
length
).
toBe
(
5
)
// if(list){
// const getList = await list.$$('.item')
// console.log("getList: ",getList);
// expect(getList.length).toBe(5)
// }
})
})
})
})
pages/clientDB/demo/demo.test.js
浏览文件 @
e691801a
...
@@ -12,6 +12,7 @@ describe('pages/clientDB/demo/demo.vue', () => {
...
@@ -12,6 +12,7 @@ describe('pages/clientDB/demo/demo.vue', () => {
it
(
'
未登陆
'
,
async
()
=>
{
it
(
'
未登陆
'
,
async
()
=>
{
await
roles
[
0
].
tap
()
await
roles
[
0
].
tap
()
const
start
=
Date
.
now
()
const
start
=
Date
.
now
()
// console.log('start: ',start);
const
unLogin
=
await
page
.
waitFor
(
async
()
=>
{
const
unLogin
=
await
page
.
waitFor
(
async
()
=>
{
if
(
Date
.
now
()
-
start
>
4000
){
if
(
Date
.
now
()
-
start
>
4000
){
console
.
warn
(
'
连接服务器超时
'
)
console
.
warn
(
'
连接服务器超时
'
)
...
@@ -20,9 +21,9 @@ describe('pages/clientDB/demo/demo.vue', () => {
...
@@ -20,9 +21,9 @@ describe('pages/clientDB/demo/demo.vue', () => {
const
unLoginRole
=
await
page
.
data
(
'
currentRole
'
)
const
unLoginRole
=
await
page
.
data
(
'
currentRole
'
)
return
unLoginRole
===
0
return
unLoginRole
===
0
})
})
// console.log('Date.now(): ',Date.now());
console
.
log
(
"
未登陆:
"
,
unLogin
);
console
.
log
(
"
未登陆:
"
,
unLogin
);
const
commentBtn
=
await
page
.
$
(
'
.comment-btn
'
)
const
commentBtn
=
await
page
.
$
(
'
.comment-btn
'
)
console
.
log
(
await
commentBtn
.
text
(),
"
text---------
"
);
expect
((
await
commentBtn
.
text
()).
trim
()).
toBe
(
'
写留言
'
)
expect
((
await
commentBtn
.
text
()).
trim
()).
toBe
(
'
写留言
'
)
})
})
it
(
'
用户
'
,
async
()
=>
{
it
(
'
用户
'
,
async
()
=>
{
...
@@ -40,9 +41,7 @@ describe('pages/clientDB/demo/demo.vue', () => {
...
@@ -40,9 +41,7 @@ describe('pages/clientDB/demo/demo.vue', () => {
if
(
user
){
if
(
user
){
//新增一条留言
//新增一条留言
const
userWrite
=
await
page
.
callMethod
(
'
submitComment
'
,
'
我是用户
'
)
const
userWrite
=
await
page
.
callMethod
(
'
submitComment
'
,
'
我是用户
'
)
const
usId
=
userWrite
.
id
expect
(
userWrite
.
id
).
toHaveLength
(
24
);
console
.
log
(
'
usId:
'
,
usId
);
//expect(usId).not.toBeUndefined();
}
}
})
})
it
(
'
审核员
'
,
async
()
=>
{
it
(
'
审核员
'
,
async
()
=>
{
...
...
pages/clientDB/permission-demo/permission-demo.test.js
浏览文件 @
e691801a
...
@@ -7,7 +7,6 @@ describe('pages/clientDB/permission-demo/permission-demo.vue', () => {
...
@@ -7,7 +7,6 @@ describe('pages/clientDB/permission-demo/permission-demo.vue', () => {
await
page
.
waitFor
(
'
view
'
)
await
page
.
waitFor
(
'
view
'
)
page
=
await
program
.
currentPage
()
page
=
await
program
.
currentPage
()
perPage
=
await
page
.
$
(
'
.page
'
)
perPage
=
await
page
.
$
(
'
.page
'
)
if
(
process
.
env
.
UNI_PLATFORM
===
"
h5
"
||
process
.
env
.
UNI_PLATFORM
.
startsWith
(
"
app
"
)
)
{
if
(
process
.
env
.
UNI_PLATFORM
===
"
h5
"
||
process
.
env
.
UNI_PLATFORM
.
startsWith
(
"
app
"
)
)
{
//底部角色控制条
//底部角色控制条
roles
=
await
perPage
.
$$
(
'
.roles-item
'
)
roles
=
await
perPage
.
$$
(
'
.roles-item
'
)
...
@@ -17,11 +16,12 @@ describe('pages/clientDB/permission-demo/permission-demo.vue', () => {
...
@@ -17,11 +16,12 @@ describe('pages/clientDB/permission-demo/permission-demo.vue', () => {
//底部角色控制条
//底部角色控制条
roles
=
await
setPer
.
$$
(
'
.roles-item
'
)
roles
=
await
setPer
.
$$
(
'
.roles-item
'
)
}
}
})
})
it
(
'
未登陆
'
,
async
()
=>
{
it
(
'
未登陆
'
,
async
()
=>
{
await
roles
[
0
].
tap
()
await
roles
[
0
].
tap
()
await
page
.
waitFor
(
500
)
console
.
log
(
'
rulo_index:
'
,
await
page
.
data
(
'
rulo_index
'
));
console
.
log
(
'
rulo_index:
'
,
await
page
.
data
(
'
rulo_index
'
));
console
.
log
(
'
role:
'
,
await
page
.
data
(
'
role
'
));
expect
((
await
roles
[
0
].
text
()).
trim
()).
toBe
(
'
未登陆
'
)
expect
((
await
roles
[
0
].
text
()).
trim
()).
toBe
(
'
未登陆
'
)
})
})
...
@@ -47,7 +47,6 @@ describe('pages/clientDB/permission-demo/permission-demo.vue', () => {
...
@@ -47,7 +47,6 @@ describe('pages/clientDB/permission-demo/permission-demo.vue', () => {
await
toButton
.
tap
()
await
toButton
.
tap
()
await
page
.
waitFor
(
800
)
await
page
.
waitFor
(
800
)
}
}
})
})
it
(
'
审核员
'
,
async
()
=>
{
it
(
'
审核员
'
,
async
()
=>
{
...
...
pages/clientDB/permission-demo/readme.test.js
浏览文件 @
e691801a
describe
(
'
pages/clientDB/permission-demo/readme.vue
'
,
()
=>
{
describe
(
'
pages/clientDB/permission-demo/readme.vue
'
,
()
=>
{
let
page
,
perPage
,
setPer
,
roles
;
let
page
,
perPage
,
setPer
,
roles
;
beforeAll
(
async
()
=>
{
beforeAll
(
async
()
=>
{
// 重新reLaunch至首页,并获取首页page对象(其中 program 是uni-automator自动注入的全局对象)
// 重新reLaunch至首页,并获取首页page对象(其中 program 是uni-automator自动注入的全局对象)
page
=
await
program
.
reLaunch
(
page
=
await
program
.
reLaunch
(
'
/pages/clientDB/permission-demo/readme
'
)
'
/pages/clientDB/permission-demo/readme
'
)
await
page
.
waitFor
(
'
view
'
)
await
page
.
waitFor
(
'
view
'
)
// page = await program.currentPage()
perPage
=
await
page
.
$
(
'
.page
'
)
perPage
=
await
page
.
$
(
'
.page
'
)
if
(
process
.
env
.
UNI_PLATFORM
===
"
h5
"
||
process
.
env
.
UNI_PLATFORM
.
startsWith
(
"
app
"
)
)
{
if
(
process
.
env
.
UNI_PLATFORM
===
"
h5
"
||
process
.
env
.
UNI_PLATFORM
.
startsWith
(
"
app
"
)
)
{
roles
=
await
perPage
.
$$
(
'
.roles-item
'
)
roles
=
await
perPage
.
$$
(
'
.roles-item
'
)
}
}
...
@@ -17,290 +14,196 @@ describe('pages/clientDB/permission-demo/readme.vue', () => {
...
@@ -17,290 +14,196 @@ describe('pages/clientDB/permission-demo/readme.vue', () => {
//底部角色控制条
//底部角色控制条
roles
=
await
setPer
.
$$
(
'
.roles-item
'
)
roles
=
await
setPer
.
$$
(
'
.roles-item
'
)
}
}
})
})
it
(
'
用户
'
,
async
()
=>
{
it
(
'
用户
'
,
async
()
=>
{
// const perPage = await page.$('.page')
//底部角色控制条
// const roles = await perPage.$$('.roles-item')
//点击创建
await
roles
[
1
].
tap
()
await
roles
[
1
].
tap
()
const
user
=
await
page
.
waitFor
(
async
()
=>
{
const
user
=
await
page
.
waitFor
(
async
()
=>
{
const
userRole
=
await
page
.
data
(
'
currentRole
'
)
const
userRole
=
await
page
.
data
(
'
currentRole
'
)
return
userRole
==
'
user
'
return
userRole
==
'
user
'
})
})
console
.
log
(
"
user:
"
,
user
);
console
.
log
(
"
user:
"
,
user
);
if
(
user
){
if
(
user
){
const
getData
=
await
page
.
callMethod
(
'
getFn
'
,
'
uid,username,nickname,state
'
)
const
getData
=
await
page
.
callMethod
(
'
getFn
'
,
'
uid,username,nickname,state
'
)
expect
(
getData
).
not
.
toBeUndefined
();
expect
(
getData
).
not
.
toBeUndefined
();
const
removeAll
=
await
page
.
callMethod
(
'
removeFn
'
,
'
uid,username,nickname,state
'
)
const
removeAll
=
await
page
.
callMethod
(
'
removeFn
'
,
'
uid,username,nickname,state
'
)
// expect(removeAll.code).toBe('PERMISSION_ERROR')
// expect(removeAll.code).toBe('PERMISSION_ERROR')
//创建一条数据
//创建一条数据
await
page
.
callMethod
(
'
addFn
'
)
await
page
.
callMethod
(
'
addFn
'
)
//更新创建者自己的昵称
//更新创建者自己的昵称
await
page
.
callMethod
(
await
page
.
callMethod
(
'
updateFn
'
,
'
updateFn
'
,
{
"
nickname
"
:
'
新昵称
'
},
'
uid == $env.uid
'
{
"
nickname
"
:
'
新昵称
'
},
'
uid == $env.uid
'
)
)
const
updateAllNickname
=
await
page
.
callMethod
(
const
updateAllNickname
=
await
page
.
callMethod
(
'
updateFn
'
,
'
updateFn
'
,
{
"
nickname
"
:
'
新昵称
'
}
{
"
nickname
"
:
'
新昵称
'
}
)
)
// expect(updateAllNickname.code).toBe("PERMISSION_ERROR")
// expect(updateAllNickname.code).toBe("PERMISSION_ERROR")
const
updateState
=
await
page
.
callMethod
(
'
updateFn
'
,{
state
:
1
})
const
updateState
=
await
page
.
callMethod
(
'
updateFn
'
,{
state
:
1
})
// expect(updateState.code).toBe('PERMISSION_ERROR')
// expect(updateState.code).toBe('PERMISSION_ERROR')
const
updateAllUsername
=
await
page
.
callMethod
(
const
updateAllUsername
=
await
page
.
callMethod
(
'
updateFn
'
,
'
updateFn
'
,
{
"
username
"
:
"
新姓名
"
}
{
"
username
"
:
"
新姓名
"
}
)
)
// expect(updateAllUsername.code).toBe('PERMISSION_ERROR')
// expect(updateAllUsername.code).toBe('PERMISSION_ERROR')
const
updateUsername
=
await
page
.
callMethod
(
const
updateUsername
=
await
page
.
callMethod
(
'
updateFn
'
,
'
updateFn
'
,
{
"
username
"
:
'
新姓名
'
},
'
uid == $env.uid
'
{
"
username
"
:
'
新姓名
'
},
'
uid == $env.uid
'
)
)
// expect(updateUsername.code).toBe('PERMISSION_ERROR')
// expect(updateUsername.code).toBe('PERMISSION_ERROR')
await
page
.
callMethod
(
await
page
.
callMethod
(
'
getFn
'
,
'
getFn
'
,
'
uid,username,nickname,state
'
'
uid,username,nickname,state
'
)
)
const
readPhone
=
await
page
.
callMethod
(
const
readPhone
=
await
page
.
callMethod
(
'
getFn
'
,
'
getFn
'
,
'
uid,username,nickname,state
'
'
uid,username,nickname,state
'
)
)
}
}
})
})
it
(
'
未登陆
'
,
async
()
=>
{
it
(
'
未登陆
'
,
async
()
=>
{
await
roles
[
0
].
tap
()
await
roles
[
0
].
tap
()
const
unlogin
=
await
page
.
waitFor
(
async
()
=>
{
const
unlogin
=
await
page
.
waitFor
(
async
()
=>
{
const
unloginRole
=
await
page
.
data
(
'
currentRole
'
)
const
unloginRole
=
await
page
.
data
(
'
currentRole
'
)
return
unloginRole
===
0
return
unloginRole
===
0
})
})
console
.
log
(
"
unlogin:
"
,
unlogin
);
console
.
log
(
"
unlogin:
"
,
unlogin
);
if
(
unlogin
){
if
(
unlogin
){
const
getData
=
await
page
.
callMethod
(
'
getFn
'
,
'
uid,username,nickname,state
'
)
const
getData
=
await
page
.
callMethod
(
'
getFn
'
,
'
uid,username,nickname,state
'
)
expect
(
getData
.
data
).
not
.
toBeUndefined
();
expect
(
getData
.
data
).
not
.
toBeUndefined
();
// console.log("getData: ",getData.data);
// console.log("getData: ",getData.data);
//删除所有
//删除所有
const
removeAll
=
await
page
.
callMethod
(
'
removeFn
'
,
'
uid,username,nickname,state
'
)
const
removeAll
=
await
page
.
callMethod
(
'
removeFn
'
,
'
uid,username,nickname,state
'
)
// expect(removeAll.code).toBe('PERMISSION_ERROR')
// expect(removeAll.code).toBe('PERMISSION_ERROR')
//创建一条数据
//创建一条数据
const
createOne
=
await
page
.
callMethod
(
'
addFn
'
)
const
createOne
=
await
page
.
callMethod
(
'
addFn
'
)
const
updateNickname
=
await
page
.
callMethod
(
const
updateNickname
=
await
page
.
callMethod
(
'
updateFn
'
,
'
updateFn
'
,
{
"
nickname
"
:
'
新昵称
'
},
'
uid == $env.uid
'
{
"
nickname
"
:
'
新昵称
'
},
'
uid == $env.uid
'
)
)
// expect(updateNickname.code).toBe('TOKEN_INVALID_ANONYMOUS_USER')
// expect(updateNickname.code).toBe('TOKEN_INVALID_ANONYMOUS_USER')
const
updateAllNickname
=
await
page
.
callMethod
(
const
updateAllNickname
=
await
page
.
callMethod
(
'
updateFn
'
,
'
updateFn
'
,
{
"
nickname
"
:
'
新昵称
'
}
{
"
nickname
"
:
'
新昵称
'
}
)
)
// expect(updateAllNickname.code).toBe('TOKEN_INVALID_ANONYMOUS_USER')
// expect(updateAllNickname.code).toBe('TOKEN_INVALID_ANONYMOUS_USER')
const
updateState
=
await
page
.
callMethod
(
'
updateFn
'
,{
state
:
1
})
const
updateState
=
await
page
.
callMethod
(
'
updateFn
'
,{
state
:
1
})
// expect(updateState.code).toBe('TOKEN_INVALID_ANONYMOUS_USER')
// expect(updateState.code).toBe('TOKEN_INVALID_ANONYMOUS_USER')
const
updateAllUsername
=
await
page
.
callMethod
(
const
updateAllUsername
=
await
page
.
callMethod
(
'
updateFn
'
,
'
updateFn
'
,
{
"
username
"
:
"
新姓名
"
}
{
"
username
"
:
"
新姓名
"
}
)
)
// console.log("updateAllUsername: ",updateAllUsername);
// console.log("updateAllUsername: ",updateAllUsername);
// expect(updateAllUsername.code).toBe('TOKEN_INVALID_ANONYMOUS_USER')
// expect(updateAllUsername.code).toBe('TOKEN_INVALID_ANONYMOUS_USER')
const
updateUsername
=
await
page
.
callMethod
(
const
updateUsername
=
await
page
.
callMethod
(
'
updateFn
'
,
'
updateFn
'
,
{
"
username
"
:
'
新姓名
'
},
'
uid == $env.uid
'
{
"
username
"
:
'
新姓名
'
},
'
uid == $env.uid
'
)
)
// expect(updateUsername.code).toBe('TOKEN_INVALID_ANONYMOUS_USER')
// expect(updateUsername.code).toBe('TOKEN_INVALID_ANONYMOUS_USER')
await
page
.
callMethod
(
await
page
.
callMethod
(
'
getFn
'
,
'
getFn
'
,
'
uid,username,nickname,state
'
'
uid,username,nickname,state
'
)
)
const
readPhone
=
await
page
.
callMethod
(
const
readPhone
=
await
page
.
callMethod
(
'
getFn
'
,
'
getFn
'
,
'
uid,username,nickname,state
'
'
uid,username,nickname,state
'
)
)
}
}
})
})
it
(
'
审核员
'
,
async
()
=>
{
it
(
'
审核员
'
,
async
()
=>
{
// const perPage = await page.$('.page')
//底部角色控制条
// const roles = await perPage.$$('.roles-item')
//点击创建
await
roles
[
2
].
tap
()
await
roles
[
2
].
tap
()
const
auditor
=
await
page
.
waitFor
(
async
()
=>
{
const
auditor
=
await
page
.
waitFor
(
async
()
=>
{
const
auditorRole
=
await
page
.
data
(
'
currentRole
'
)
const
auditorRole
=
await
page
.
data
(
'
currentRole
'
)
return
auditorRole
==
'
auditor
'
return
auditorRole
==
'
auditor
'
})
})
// console.log(auditor);
console
.
log
(
"
auditor
"
,
auditor
);
if
(
auditor
){
if
(
auditor
){
const
getData
=
await
page
.
callMethod
(
'
getFn
'
,
'
uid,username,nickname,state
'
)
const
getData
=
await
page
.
callMethod
(
'
getFn
'
,
'
uid,username,nickname,state
'
)
expect
(
getData
).
not
.
toBeUndefined
();
expect
(
getData
).
not
.
toBeUndefined
();
const
removeAll
=
await
page
.
callMethod
(
'
removeFn
'
,
'
uid,username,nickname,state
'
)
const
removeAll
=
await
page
.
callMethod
(
'
removeFn
'
,
'
uid,username,nickname,state
'
)
expect
(
removeAll
.
code
).
toBe
(
'
PERMISSION_ERROR
'
)
expect
(
removeAll
.
code
).
toBe
(
'
PERMISSION_ERROR
'
)
await
page
.
callMethod
(
'
addFn
'
)
await
page
.
callMethod
(
'
addFn
'
)
//更新创建者
//更新创建者
await
page
.
callMethod
(
await
page
.
callMethod
(
'
updateFn
'
,
'
updateFn
'
,
{
"
nickname
"
:
'
新昵称
'
},
'
uid == $env.uid
'
{
"
nickname
"
:
'
新昵称
'
},
'
uid == $env.uid
'
)
)
//更新表中所有
//更新表中所有
const
updateAllNickname
=
await
page
.
callMethod
(
const
updateAllNickname
=
await
page
.
callMethod
(
'
updateFn
'
,
'
updateFn
'
,
{
"
nickname
"
:
'
新昵称
'
}
{
"
nickname
"
:
'
新昵称
'
}
)
)
//state更新为1
//state更新为1
await
page
.
callMethod
(
'
updateFn
'
,{
state
:
1
})
await
page
.
callMethod
(
'
updateFn
'
,{
state
:
1
})
//更新表中所有
//更新表中所有
await
page
.
callMethod
(
await
page
.
callMethod
(
'
updateFn
'
,
'
updateFn
'
,
{
"
username
"
:
"
新姓名
"
}
{
"
username
"
:
"
新姓名
"
}
)
)
//更新创建者
//更新创建者
await
page
.
callMethod
(
await
page
.
callMethod
(
'
updateFn
'
,
'
updateFn
'
,
{
"
username
"
:
'
新姓名
'
},
'
uid == $env.uid
'
{
"
username
"
:
'
新姓名
'
},
'
uid == $env.uid
'
)
)
//读不含phone
//读不含phone
await
page
.
callMethod
(
await
page
.
callMethod
(
'
getFn
'
,
'
getFn
'
,
'
uid,username,nickname,state
'
'
uid,username,nickname,state
'
)
)
//读含有phone
//读含有phone
await
page
.
callMethod
(
await
page
.
callMethod
(
'
getFn
'
,
'
getFn
'
,
'
uid,username,nickname,state
'
'
uid,username,nickname,state
'
)
)
}
}
})
})
it
(
'
管理员
'
,
async
()
=>
{
it
(
'
管理员
'
,
async
()
=>
{
// const perPage = await page.$('.page')
//底部角色控制条
// const roles = await perPage.$$('.roles-item')
//点击创建
await
roles
[
3
].
tap
()
await
roles
[
3
].
tap
()
const
admin
=
await
page
.
waitFor
(
async
()
=>
{
const
admin
=
await
page
.
waitFor
(
async
()
=>
{
const
adminRole
=
await
page
.
data
(
'
currentRole
'
)
const
adminRole
=
await
page
.
data
(
'
currentRole
'
)
return
adminRole
==
'
admin
'
return
adminRole
==
'
admin
'
})
})
console
.
log
(
admin
);
console
.
log
(
"
admin
"
,
admin
);
if
(
admin
){
if
(
admin
){
const
getData
=
await
page
.
callMethod
(
'
getFn
'
,
'
uid,username,nickname,state
'
)
const
getData
=
await
page
.
callMethod
(
'
getFn
'
,
'
uid,username,nickname,state
'
)
expect
(
getData
).
not
.
toBeUndefined
();
expect
(
getData
).
not
.
toBeUndefined
();
//删除所有
//删除所有
await
page
.
callMethod
(
'
removeFn
'
,
'
uid,username,nickname,state
'
)
await
page
.
callMethod
(
'
removeFn
'
,
'
uid,username,nickname,state
'
)
//新增一条
//新增一条
await
page
.
callMethod
(
'
addFn
'
)
await
page
.
callMethod
(
'
addFn
'
)
//更新创建者
//更新创建者
await
page
.
callMethod
(
await
page
.
callMethod
(
'
updateFn
'
,
'
updateFn
'
,
{
"
nickname
"
:
'
新昵称
'
},
'
uid == $env.uid
'
{
"
nickname
"
:
'
新昵称
'
},
'
uid == $env.uid
'
)
)
//更新表中所有
//更新表中所有
const
updateAllNickname
=
await
page
.
callMethod
(
const
updateAllNickname
=
await
page
.
callMethod
(
'
updateFn
'
,
'
updateFn
'
,
{
"
nickname
"
:
'
新昵称
'
}
{
"
nickname
"
:
'
新昵称
'
}
)
)
//state更新为1
//state更新为1
await
page
.
callMethod
(
'
updateFn
'
,{
state
:
1
})
await
page
.
callMethod
(
'
updateFn
'
,{
state
:
1
})
//更新表中所有
//更新表中所有
await
page
.
callMethod
(
await
page
.
callMethod
(
'
updateFn
'
,
'
updateFn
'
,
{
"
username
"
:
"
新姓名
"
}
{
"
username
"
:
"
新姓名
"
}
)
)
//更新创建者
//更新创建者
await
page
.
callMethod
(
await
page
.
callMethod
(
'
updateFn
'
,
'
updateFn
'
,
{
"
username
"
:
'
新姓名
'
},
'
uid == $env.uid
'
{
"
username
"
:
'
新姓名
'
},
'
uid == $env.uid
'
)
)
//读不含phone
//读不含phone
await
page
.
callMethod
(
await
page
.
callMethod
(
'
getFn
'
,
'
getFn
'
,
'
uid,username,nickname,state
'
'
uid,username,nickname,state
'
)
)
//读含有phone
//读含有phone
await
page
.
callMethod
(
await
page
.
callMethod
(
'
getFn
'
,
'
getFn
'
,
'
uid,username,nickname,state
'
'
uid,username,nickname,state
'
)
)
}
}
})
})
})
})
\ No newline at end of file
pages/clientDB/permission-field-simple/permission-field-simple.test.js
浏览文件 @
e691801a
...
@@ -199,14 +199,13 @@ describe('pages/clientDB/permission-field-simple/permission-field-simple.nvue',
...
@@ -199,14 +199,13 @@ describe('pages/clientDB/permission-field-simple/permission-field-simple.nvue',
"
type
"
:
"
create
"
,
"
type
"
:
"
create
"
,
"
index
"
:
2
,
"
index
"
:
2
,
})
})
console
.
log
(
'
createUserB:
'
,
createUserB
);
//
console.log('createUserB: ',createUserB);
// expect(createUserB).toBe('[permission-test-12.ip.write]权限校验未通过'
)
expect
(
createUserB
).
toBe
(
errMsgA
)
await
page
.
callMethod
(
'
myFn
'
,
{
await
page
.
callMethod
(
'
myFn
'
,
{
"
type
"
:
"
create
"
,
"
type
"
:
"
create
"
,
"
index
"
:
2
,
"
index
"
:
2
,
"
field
"
:
"
_id,state,create_time,text
"
,
"
field
"
:
"
_id,state,create_time,text
"
,
})
})
})
})
it
(
'
读取--用户
'
,
async
()
=>
{
it
(
'
读取--用户
'
,
async
()
=>
{
...
...
pages/clientDB/permission-table-compound/permission-table-compound.test.js
浏览文件 @
e691801a
...
@@ -214,15 +214,15 @@ describe('pages/clientDB/permission-table-compound/permission-table-compound.vue
...
@@ -214,15 +214,15 @@ describe('pages/clientDB/permission-table-compound/permission-table-compound.vue
"
index
"
:
0
,
"
index
"
:
0
,
"
where
"
:
"
create_time > 1613534788761
"
"
where
"
:
"
create_time > 1613534788761
"
})
})
console
.
log
(
readUserA
,
"
readUserA---------
"
);
//
console.log(readUserA,"readUserA---------");
//expect(readUserA).toBe('权限校验未通过'
)
expect
(
readUserA
).
toBe
(
errMsgA
)
const
readUserB
=
await
page
.
callMethod
(
'
myFn
'
,
{
const
readUserB
=
await
page
.
callMethod
(
'
myFn
'
,
{
"
type
"
:
"
read
"
,
"
type
"
:
"
read
"
,
"
index
"
:
0
"
index
"
:
0
})
})
console
.
log
(
readUserB
,
"
readUserB---------
"
);
//
console.log(readUserB,"readUserB---------");
//expect(readUserB).toBe('权限校验未通过'
)
expect
(
readUserB
).
toBe
(
errMsgA
)
await
page
.
callMethod
(
'
myFn
'
,
{
await
page
.
callMethod
(
'
myFn
'
,
{
"
type
"
:
"
read
"
,
"
type
"
:
"
read
"
,
...
@@ -258,8 +258,8 @@ describe('pages/clientDB/permission-table-compound/permission-table-compound.vue
...
@@ -258,8 +258,8 @@ describe('pages/clientDB/permission-table-compound/permission-table-compound.vue
"
index
"
:
0
,
"
index
"
:
0
,
"
where
"
:
"
create_time > 1613534788761
"
"
where
"
:
"
create_time > 1613534788761
"
})
})
console
.
log
(
updateUserA
,
"
updateUserA---------
"
);
//
console.log(updateUserA,"updateUserA---------");
//expect(updateUserA).toBe('权限校验未通过'
)
expect
(
updateUserA
).
toBe
(
errMsgA
)
const
updateUserB
=
await
page
.
callMethod
(
'
myFn
'
,
{
const
updateUserB
=
await
page
.
callMethod
(
'
myFn
'
,
{
"
type
"
:
"
update
"
,
"
type
"
:
"
update
"
,
...
...
pages/clientDB/permission-table-simple/permission-table-simple.test.js
浏览文件 @
e691801a
...
@@ -37,7 +37,8 @@ describe('pages/clientDB/permission-table-simple/permission-table-simple.vue', (
...
@@ -37,7 +37,8 @@ describe('pages/clientDB/permission-table-simple/permission-table-simple.vue', (
"
type
"
:
"
create
"
,
"
type
"
:
"
create
"
,
"
index
"
:
0
"
index
"
:
0
})
})
expect
(
createA
.
success
).
toBeTruthy
()
// console.log('createA: ',createA);
expect
(
createA
.
result
.
id
).
toHaveLength
(
24
)
// 禁止任何角色创建,管理员除外
// 禁止任何角色创建,管理员除外
const
createB
=
await
page
.
callMethod
(
'
myFn
'
,
{
const
createB
=
await
page
.
callMethod
(
'
myFn
'
,
{
...
@@ -73,9 +74,9 @@ describe('pages/clientDB/permission-table-simple/permission-table-simple.vue', (
...
@@ -73,9 +74,9 @@ describe('pages/clientDB/permission-table-simple/permission-table-simple.vue', (
"
index
"
:
6
,
"
index
"
:
6
,
"
action
"
:
"
add_view_count
"
"
action
"
:
"
add_view_count
"
})
})
expect
(
createAction
.
success
).
toBeTruthy
()
// console.log('createAction: ',createAction);
expect
(
createAction
.
result
.
id
).
toHaveLength
(
24
)
}
}
})
})
it
(
'
读取--未登陆
'
,
async
()
=>
{
it
(
'
读取--未登陆
'
,
async
()
=>
{
...
@@ -95,8 +96,8 @@ describe('pages/clientDB/permission-table-simple/permission-table-simple.vue', (
...
@@ -95,8 +96,8 @@ describe('pages/clientDB/permission-table-simple/permission-table-simple.vue', (
"
type
"
:
"
read
"
,
"
type
"
:
"
read
"
,
"
index
"
:
0
"
index
"
:
0
})
})
console
.
log
(
'
readA:
'
,
readA
);
//
console.log('readA: ',readA);
// expect(readA.success).toBeTruthy(
)
expect
(
readA
.
result
.
data
.
length
).
toBeGreaterThanOrEqual
(
1
)
// 禁止任何角色读取
// 禁止任何角色读取
const
readB
=
await
page
.
callMethod
(
'
myFn
'
,
{
const
readB
=
await
page
.
callMethod
(
'
myFn
'
,
{
...
@@ -132,8 +133,8 @@ describe('pages/clientDB/permission-table-simple/permission-table-simple.vue', (
...
@@ -132,8 +133,8 @@ describe('pages/clientDB/permission-table-simple/permission-table-simple.vue', (
"
type
"
:
"
read
"
,
"
type
"
:
"
read
"
,
"
index
"
:
3
"
index
"
:
3
})
})
console
.
log
(
'
readF:
'
,
readF
);
//
console.log('readF: ',readF);
// expect(readF.errMsg).toBe(errMsg
C
)
// expect(readF.errMsg).toBe(errMsg
B
)
// 只能读取1分钟内创建的数据,先创建数据
// 只能读取1分钟内创建的数据,先创建数据
...
@@ -149,8 +150,7 @@ describe('pages/clientDB/permission-table-simple/permission-table-simple.vue', (
...
@@ -149,8 +150,7 @@ describe('pages/clientDB/permission-table-simple/permission-table-simple.vue', (
"
index
"
:
4
,
"
index
"
:
4
,
"
where
"
:
"
create_time > 1613541303576
"
"
where
"
:
"
create_time > 1613541303576
"
})
})
console
.
log
(
'
readH:
'
,
readH
);
// console.log('readH: ',readH);
// expect(readH.success).toBeTruthy()
// 读取全表数据
// 读取全表数据
...
@@ -158,10 +158,9 @@ describe('pages/clientDB/permission-table-simple/permission-table-simple.vue', (
...
@@ -158,10 +158,9 @@ describe('pages/clientDB/permission-table-simple/permission-table-simple.vue', (
"
type
"
:
"
read
"
,
"
type
"
:
"
read
"
,
"
index
"
:
4
"
index
"
:
4
})
})
console
.
log
(
'
readI:
'
,
readI
);
//
console.log('readI: ',readI);
// expect(readI.errCode).toBe(0)
// expect(readI.errCode).toBe(0)
// 限审核员读取
// 限审核员读取
const
readJ
=
await
page
.
callMethod
(
'
myFn
'
,
{
const
readJ
=
await
page
.
callMethod
(
'
myFn
'
,
{
"
type
"
:
"
create
"
,
"
type
"
:
"
create
"
,
...
@@ -182,7 +181,7 @@ describe('pages/clientDB/permission-table-simple/permission-table-simple.vue', (
...
@@ -182,7 +181,7 @@ describe('pages/clientDB/permission-table-simple/permission-table-simple.vue', (
"
index
"
:
6
,
"
index
"
:
6
,
"
action
"
:
"
add_view_count
"
"
action
"
:
"
add_view_count
"
})
})
expect
(
actionRead
.
errCode
).
toBe
(
0
)
expect
(
actionRead
.
result
.
data
.
length
).
toBeGreaterThanOrEqual
(
1
)
}
}
})
})
...
@@ -205,8 +204,7 @@ describe('pages/clientDB/permission-table-simple/permission-table-simple.vue', (
...
@@ -205,8 +204,7 @@ describe('pages/clientDB/permission-table-simple/permission-table-simple.vue', (
"
index
"
:
0
"
index
"
:
0
})
})
// console.log('updateA: ',updateA);
// console.log('updateA: ',updateA);
// expect(updateA.result.updated).toBeGreaterThanOrEqual(1)
expect
(
updateA
.
result
.
updated
).
toBeGreaterThanOrEqual
(
1
)
expect
(
updateA
.
result
.
errCode
).
toBe
(
0
)
// 禁止任何角色更新,管理员除外
// 禁止任何角色更新,管理员除外
const
updateB
=
await
page
.
callMethod
(
'
myFn
'
,
{
const
updateB
=
await
page
.
callMethod
(
'
myFn
'
,
{
...
@@ -242,8 +240,8 @@ describe('pages/clientDB/permission-table-simple/permission-table-simple.vue', (
...
@@ -242,8 +240,8 @@ describe('pages/clientDB/permission-table-simple/permission-table-simple.vue', (
"
type
"
:
"
update
"
,
"
type
"
:
"
update
"
,
"
index
"
:
3
"
index
"
:
3
})
})
console
.
log
(
'
updateF:
'
,
updateF
);
// console.log('updateF:----------
',updateF);
//
expect(updateF.result.updated).toBe(0)
expect
(
updateF
.
result
.
updated
).
toBe
(
0
)
// 只更新1分钟内创建的数据,先创建数据
// 只更新1分钟内创建的数据,先创建数据
const
updateG
=
await
page
.
callMethod
(
'
myFn
'
,
{
const
updateG
=
await
page
.
callMethod
(
'
myFn
'
,
{
...
@@ -258,6 +256,7 @@ describe('pages/clientDB/permission-table-simple/permission-table-simple.vue', (
...
@@ -258,6 +256,7 @@ describe('pages/clientDB/permission-table-simple/permission-table-simple.vue', (
"
index
"
:
4
,
"
index
"
:
4
,
"
where
"
:
"
create_time > 1613546251521
"
"
where
"
:
"
create_time > 1613546251521
"
})
})
// console.log('updateH:------------------ ',updateH);
expect
(
updateH
.
result
.
updated
).
toBe
(
0
)
expect
(
updateH
.
result
.
updated
).
toBe
(
0
)
// 更新全表数据
// 更新全表数据
...
@@ -265,7 +264,7 @@ describe('pages/clientDB/permission-table-simple/permission-table-simple.vue', (
...
@@ -265,7 +264,7 @@ describe('pages/clientDB/permission-table-simple/permission-table-simple.vue', (
"
type
"
:
"
update
"
,
"
type
"
:
"
update
"
,
"
index
"
:
4
"
index
"
:
4
})
})
expect
(
updateI
.
success
).
toBeTruthy
(
)
expect
(
updateI
.
result
.
updated
).
toBe
(
0
)
//限审核员更新全表数据
//限审核员更新全表数据
const
updateJ
=
await
page
.
callMethod
(
'
myFn
'
,
{
const
updateJ
=
await
page
.
callMethod
(
'
myFn
'
,
{
...
@@ -288,7 +287,6 @@ describe('pages/clientDB/permission-table-simple/permission-table-simple.vue', (
...
@@ -288,7 +287,6 @@ describe('pages/clientDB/permission-table-simple/permission-table-simple.vue', (
"
action
"
:
"
add_view_count
"
"
action
"
:
"
add_view_count
"
})
})
expect
(
updateAction
.
result
.
updated
).
toBe
(
1
)
expect
(
updateAction
.
result
.
updated
).
toBe
(
1
)
}
}
})
})
...
@@ -310,8 +308,7 @@ describe('pages/clientDB/permission-table-simple/permission-table-simple.vue', (
...
@@ -310,8 +308,7 @@ describe('pages/clientDB/permission-table-simple/permission-table-simple.vue', (
"
index
"
:
0
"
index
"
:
0
})
})
// console.log("deleteA",deleteA);
// console.log("deleteA",deleteA);
// expect(deleteA.result.deleted).toBeGreaterThanOrEqual(0)
expect
(
deleteA
.
result
.
deleted
).
toBeGreaterThanOrEqual
(
1
)
expect
(
deleteA
.
result
.
errCode
).
toBe
(
0
)
// 禁止任何角色删除,管理员除外
// 禁止任何角色删除,管理员除外
const
deleteB
=
await
page
.
callMethod
(
'
myFn
'
,
{
const
deleteB
=
await
page
.
callMethod
(
'
myFn
'
,
{
...
@@ -347,9 +344,8 @@ describe('pages/clientDB/permission-table-simple/permission-table-simple.vue', (
...
@@ -347,9 +344,8 @@ describe('pages/clientDB/permission-table-simple/permission-table-simple.vue', (
"
type
"
:
"
delete
"
,
"
type
"
:
"
delete
"
,
"
index
"
:
3
"
index
"
:
3
})
})
console
.
log
(
'
deleteF:
'
,
deleteF
);
// console.log('deleteF: ',deleteF);
// expect(deleteF.success).toBeTruthy()
expect
(
deleteF
.
result
.
deleted
).
toBe
(
0
)
// expect(deleteF.result.deleted).toBe(0)
// 只更新1分钟内创建的数据,先创建数据
// 只更新1分钟内创建的数据,先创建数据
const
deleteG
=
await
page
.
callMethod
(
'
myFn
'
,
{
const
deleteG
=
await
page
.
callMethod
(
'
myFn
'
,
{
...
@@ -357,23 +353,19 @@ describe('pages/clientDB/permission-table-simple/permission-table-simple.vue', (
...
@@ -357,23 +353,19 @@ describe('pages/clientDB/permission-table-simple/permission-table-simple.vue', (
"
index
"
:
4
"
index
"
:
4
})
})
expect
(
deleteG
.
errMsg
).
toBe
(
errMsgC
)
expect
(
deleteG
.
errMsg
).
toBe
(
errMsgC
)
// 只更新1分钟内创建的数据
// 只更新1分钟内创建的数据
expect
((
await
page
.
callMethod
(
'
myFn
'
,
{
await
page
.
callMethod
(
'
myFn
'
,
{
"
type
"
:
"
delete
"
,
"
type
"
:
"
delete
"
,
"
index
"
:
4
,
"
index
"
:
4
,
"
where
"
:
"
create_time > 1613546644107
"
"
where
"
:
"
create_time > 1613546644107
"
})
})
).
success
).
toBeTruthy
()
// 删除全表数据
// 删除全表数据
expect
((
await
page
.
callMethod
(
'
myFn
'
,
{
await
page
.
callMethod
(
'
myFn
'
,
{
"
type
"
:
"
delete
"
,
"
type
"
:
"
delete
"
,
"
index
"
:
4
"
index
"
:
4
})
})
).
success
).
toBeTruthy
()
// 删除全表 仅审核员
// 删除全表 仅审核员
const
deleteH
=
await
page
.
callMethod
(
'
myFn
'
,
{
const
deleteH
=
await
page
.
callMethod
(
'
myFn
'
,
{
...
@@ -395,7 +387,8 @@ describe('pages/clientDB/permission-table-simple/permission-table-simple.vue', (
...
@@ -395,7 +387,8 @@ describe('pages/clientDB/permission-table-simple/permission-table-simple.vue', (
"
index
"
:
6
,
"
index
"
:
6
,
"
action
"
:
"
add_view_count
"
"
action
"
:
"
add_view_count
"
})
})
expect
(
deleteAction
.
result
.
deleted
).
toBe
(
1
)
// console.log('deleteAction: ',deleteAction);
expect
(
deleteAction
.
result
.
deleted
).
toBeGreaterThanOrEqual
(
1
)
})
})
it
(
'
创建--用户
'
,
async
()
=>
{
it
(
'
创建--用户
'
,
async
()
=>
{
...
@@ -469,7 +462,8 @@ describe('pages/clientDB/permission-table-simple/permission-table-simple.vue', (
...
@@ -469,7 +462,8 @@ describe('pages/clientDB/permission-table-simple/permission-table-simple.vue', (
"
type
"
:
"
read
"
,
"
type
"
:
"
read
"
,
"
index
"
:
0
"
index
"
:
0
})
})
console
.
log
(
'
readUserA:
'
,
readUserA
);
// console.log('readUserA: ',readUserA);
expect
(
readUserA
.
errCode
).
toBe
(
0
)
// expect(readUserA.result.data.length).toBeGreaterThan(0)
// expect(readUserA.result.data.length).toBeGreaterThan(0)
// 仅管理员可读
// 仅管理员可读
...
@@ -484,7 +478,8 @@ describe('pages/clientDB/permission-table-simple/permission-table-simple.vue', (
...
@@ -484,7 +478,8 @@ describe('pages/clientDB/permission-table-simple/permission-table-simple.vue', (
"
type
"
:
"
read
"
,
"
type
"
:
"
read
"
,
"
index
"
:
2
"
index
"
:
2
})
})
console
.
log
(
'
readUserC:
'
,
readUserC
);
// console.log('readUserC: ',readUserC);
// expect(readUserA.errCode).toBe(0)
expect
(
readUserC
.
result
.
data
.
length
).
toBeGreaterThan
(
0
)
expect
(
readUserC
.
result
.
data
.
length
).
toBeGreaterThan
(
0
)
// 只能读取自己创建的数据,先创建数据
// 只能读取自己创建的数据,先创建数据
...
@@ -500,7 +495,7 @@ describe('pages/clientDB/permission-table-simple/permission-table-simple.vue', (
...
@@ -500,7 +495,7 @@ describe('pages/clientDB/permission-table-simple/permission-table-simple.vue', (
"
index
"
:
3
,
"
index
"
:
3
,
"
where
"
:
"
uid == $env.uid
"
"
where
"
:
"
uid == $env.uid
"
})
})
console
.
log
(
'
readUserE:
'
,
readUserE
);
//
console.log('readUserE: ',readUserE);
expect
(
readUserE
.
result
.
data
.
length
).
toBeGreaterThan
(
0
)
expect
(
readUserE
.
result
.
data
.
length
).
toBeGreaterThan
(
0
)
// 读取全表数据
// 读取全表数据
...
@@ -508,7 +503,7 @@ describe('pages/clientDB/permission-table-simple/permission-table-simple.vue', (
...
@@ -508,7 +503,7 @@ describe('pages/clientDB/permission-table-simple/permission-table-simple.vue', (
"
type
"
:
"
read
"
,
"
type
"
:
"
read
"
,
"
index
"
:
3
"
index
"
:
3
})
})
console
.
log
(
'
readUserF:
'
,
readUserF
);
// console.log('readUserF: --------------
',readUserF);
expect
(
readUserF
.
result
.
data
.
length
).
toBeGreaterThan
(
0
)
expect
(
readUserF
.
result
.
data
.
length
).
toBeGreaterThan
(
0
)
// 只读取1分钟内创建的数据,先创建数据
// 只读取1分钟内创建的数据,先创建数据
...
@@ -524,7 +519,7 @@ describe('pages/clientDB/permission-table-simple/permission-table-simple.vue', (
...
@@ -524,7 +519,7 @@ describe('pages/clientDB/permission-table-simple/permission-table-simple.vue', (
"
index
"
:
4
,
"
index
"
:
4
,
"
where
"
:
"
create_time > 1613541303576
"
"
where
"
:
"
create_time > 1613541303576
"
})
})
console
.
log
(
'
readUserH:
'
,
readUserH
);
//
console.log('readUserH: ',readUserH);
expect
(
readUserH
.
result
.
data
.
length
).
toBeGreaterThan
(
0
)
expect
(
readUserH
.
result
.
data
.
length
).
toBeGreaterThan
(
0
)
// 读取全表数据
// 读取全表数据
...
@@ -532,7 +527,7 @@ describe('pages/clientDB/permission-table-simple/permission-table-simple.vue', (
...
@@ -532,7 +527,7 @@ describe('pages/clientDB/permission-table-simple/permission-table-simple.vue', (
"
type
"
:
"
read
"
,
"
type
"
:
"
read
"
,
"
index
"
:
4
"
index
"
:
4
})
})
console
.
log
(
'
readUserI:
'
,
readUserI
);
//
console.log('readUserI: ',readUserI);
expect
(
readUserI
.
result
.
data
.
length
).
toBeGreaterThanOrEqual
(
1
)
expect
(
readUserI
.
result
.
data
.
length
).
toBeGreaterThanOrEqual
(
1
)
// 仅审核员读取全表数据
// 仅审核员读取全表数据
...
@@ -555,8 +550,9 @@ describe('pages/clientDB/permission-table-simple/permission-table-simple.vue', (
...
@@ -555,8 +550,9 @@ describe('pages/clientDB/permission-table-simple/permission-table-simple.vue', (
"
index
"
:
6
,
"
index
"
:
6
,
"
action
"
:
"
add_view_count
"
"
action
"
:
"
add_view_count
"
})
})
console
.
log
(
'
readUserO:
'
,
readUserO
);
//
console.log('readUserO: ',readUserO);
// expect(readUserO.result.data.length).toBeGreaterThan(0)
// expect(readUserO.result.data.length).toBeGreaterThan(0)
expect
(
readUserO
.
errCode
).
toBe
(
0
)
})
})
...
@@ -590,8 +586,7 @@ describe('pages/clientDB/permission-table-simple/permission-table-simple.vue', (
...
@@ -590,8 +586,7 @@ describe('pages/clientDB/permission-table-simple/permission-table-simple.vue', (
"
type
"
:
"
update
"
,
"
type
"
:
"
update
"
,
"
index
"
:
2
"
index
"
:
2
})
})
console
.
log
(
'
updateUserC:
'
,
updateUserC
);
expect
(
updateUserC
.
result
.
updated
).
toBeGreaterThanOrEqual
(
1
)
// expect(updateUserC.result.updated).toBe(1)
// 仅更新自己创建的数据 先创建数据
// 仅更新自己创建的数据 先创建数据
const
updateUserD
=
await
page
.
callMethod
(
'
myFn
'
,
{
const
updateUserD
=
await
page
.
callMethod
(
'
myFn
'
,
{
...
@@ -613,8 +608,8 @@ describe('pages/clientDB/permission-table-simple/permission-table-simple.vue', (
...
@@ -613,8 +608,8 @@ describe('pages/clientDB/permission-table-simple/permission-table-simple.vue', (
"
type
"
:
"
update
"
,
"
type
"
:
"
update
"
,
"
index
"
:
3
"
index
"
:
3
})
})
// console.log('updateUserF: ',updateUserF);
// console.log('updateUserF:
------------------
',updateUserF);
expect
(
updateUserF
.
result
.
errCode
).
toBe
(
0
)
expect
(
updateUserF
.
result
.
updated
).
toBeGreaterThanOrEqual
(
1
)
// 只更新1分钟内创建的数据 先创建数据
// 只更新1分钟内创建的数据 先创建数据
const
updateUserG
=
await
page
.
callMethod
(
'
myFn
'
,
{
const
updateUserG
=
await
page
.
callMethod
(
'
myFn
'
,
{
...
@@ -658,9 +653,8 @@ describe('pages/clientDB/permission-table-simple/permission-table-simple.vue', (
...
@@ -658,9 +653,8 @@ describe('pages/clientDB/permission-table-simple/permission-table-simple.vue', (
"
index
"
:
6
,
"
index
"
:
6
,
"
action
"
:
"
add_view_count
"
"
action
"
:
"
add_view_count
"
})
})
console
.
log
(
'
updateUserAction:
'
,
updateUserAction
);
// console.log('updateUserAction: ',updateUserAction);
// expect(updateUserAction.result.updated).toBe(1)
expect
(
updateUserAction
.
result
.
updated
).
toBeGreaterThanOrEqual
(
1
)
// expect(updateUserAction.errCode).toBe(0)
})
})
it
(
'
删除--用户
'
,
async
()
=>
{
it
(
'
删除--用户
'
,
async
()
=>
{
...
...
pages/clientDB/unicloud-db-demo/unicloud-db-demo.test.js
浏览文件 @
e691801a
...
@@ -6,30 +6,23 @@ describe('pages/clientDB/unicloud-db-demo/unicloud-db-demo', () => {
...
@@ -6,30 +6,23 @@ describe('pages/clientDB/unicloud-db-demo/unicloud-db-demo', () => {
page
=
await
program
.
reLaunch
(
'
/pages/clientDB/unicloud-db-demo/unicloud-db-demo
'
)
page
=
await
program
.
reLaunch
(
'
/pages/clientDB/unicloud-db-demo/unicloud-db-demo
'
)
await
page
.
waitFor
(
'
view
'
)
await
page
.
waitFor
(
'
view
'
)
})
})
it
(
"
增
"
,
async
()
=>
{
it
(
"
增-删
"
,
async
()
=>
{
// expect.assertions(1);
const
count
=
await
page
.
data
(
'
getcount
'
)
console
.
log
(
"
count:
"
,
count
);
/* expect.assertions(1);
const
count
=
await
page
.
data
(
'
getcount
'
)
const
count
=
await
page
.
data
(
'
getcount
'
)
expect(count).toBeTruthy()
; */
expect
(
count
).
toBeTruthy
()
const
addData
=
await
page
.
callMethod
(
'
add
'
)
await
page
.
callMethod
(
'
add
'
)
await
page
.
waitFor
(
500
)
}
)
const
getDataList
=
await
page
.
data
(
'
dataList
'
)
it
(
"
删
"
,
async
()
=>
{
// cons
ole.log("getDataList: ",getDataList);
// cons
t getDataList = await page.data('dataList')
// expect(await getDataList.length).toBeGreaterThanOrEqual(1);
// expect(await getDataList.length).toBeGreaterThanOrEqual(1);
const
removeData
=
await
page
.
callMethod
(
'
remove
'
)
await
page
.
callMethod
(
'
remove
'
)
})
})
it
(
"
改
"
,
async
()
=>
{
it
(
"
改
"
,
async
()
=>
{
const
updateData
=
await
page
.
callMethod
(
'
update
'
)
await
page
.
callMethod
(
'
update
'
)
})
})
it
(
"
查
"
,
async
()
=>
{
it
(
"
查
"
,
async
()
=>
{
const
getFnData
=
await
page
.
callMethod
(
'
getFn
'
)
await
page
.
callMethod
(
'
getFn
'
)
})
})
it
(
"
只查一条数据
"
,
async
()
=>
{
it
(
"
只查一条数据
"
,
async
()
=>
{
//开启只查一条
//开启只查一条
const
swGetone
=
await
page
.
$
(
'
.switch-getone
'
)
const
swGetone
=
await
page
.
$
(
'
.switch-getone
'
)
...
@@ -42,25 +35,20 @@ describe('pages/clientDB/unicloud-db-demo/unicloud-db-demo', () => {
...
@@ -42,25 +35,20 @@ describe('pages/clientDB/unicloud-db-demo/unicloud-db-demo', () => {
await
swGetone
.
tap
()
await
swGetone
.
tap
()
await
page
.
waitFor
(
500
)
await
page
.
waitFor
(
500
)
})
})
it
(
"
数据翻页-replace
"
,
async
()
=>
{
it
(
"
数据翻页-replace
"
,
async
()
=>
{
expect
.
assertions
(
3
);
expect
.
assertions
(
3
);
//判断类型为翻页加载
//判断类型为翻页加载
const
replace
=
await
page
.
data
(
'
pageData
'
)
const
replace
=
await
page
.
data
(
'
pageData
'
)
expect
(
replace
).
toBe
(
'
replace
'
)
expect
(
replace
).
toBe
(
'
replace
'
)
//增加当前页码
//增加当前页码
const
pageCurrentBefore
=
await
page
.
data
(
'
pageCurrent
'
)
const
pageCurrentBefore
=
await
page
.
data
(
'
pageCurrent
'
)
const
numBox1
=
await
page
.
$
(
'
.num-box1
'
)
const
numBox1
=
await
page
.
$
(
'
.num-box1
'
)
const
numboxAdd1
=
await
numBox1
.
$
(
'
.uni-numbox__plus
'
)
const
numboxAdd1
=
await
numBox1
.
$
(
'
.uni-numbox__plus
'
)
await
numboxAdd1
.
tap
()
await
numboxAdd1
.
tap
()
await
page
.
waitFor
(
500
)
await
page
.
waitFor
(
500
)
//获取增加后的页码
//获取增加后的页码
const
pageCurrentAfter
=
await
page
.
data
(
'
pageCurrent
'
)
const
pageCurrentAfter
=
await
page
.
data
(
'
pageCurrent
'
)
expect
(
pageCurrentAfter
).
toBeGreaterThanOrEqual
(
pageCurrentBefore
);
//大于/toBeGreaterThan
expect
(
pageCurrentAfter
).
toBeGreaterThanOrEqual
(
pageCurrentBefore
);
//大于/toBeGreaterThan
//增加当前每页数量
//增加当前每页数量
const
pageSizeBefore
=
await
page
.
data
(
'
pageSize
'
)
const
pageSizeBefore
=
await
page
.
data
(
'
pageSize
'
)
const
numBox2
=
await
page
.
$
(
'
.num-box2
'
)
const
numBox2
=
await
page
.
$
(
'
.num-box2
'
)
...
@@ -70,7 +58,6 @@ describe('pages/clientDB/unicloud-db-demo/unicloud-db-demo', () => {
...
@@ -70,7 +58,6 @@ describe('pages/clientDB/unicloud-db-demo/unicloud-db-demo', () => {
//增加每页数据数量
//增加每页数据数量
const
pageSizeAfter
=
await
page
.
data
(
'
pageSize
'
)
const
pageSizeAfter
=
await
page
.
data
(
'
pageSize
'
)
expect
(
pageSizeAfter
).
toBeGreaterThanOrEqual
(
pageSizeBefore
);
//大于
expect
(
pageSizeAfter
).
toBeGreaterThanOrEqual
(
pageSizeBefore
);
//大于
})
})
it
(
"
追加数据-add
"
,
async
()
=>
{
it
(
"
追加数据-add
"
,
async
()
=>
{
...
@@ -82,7 +69,6 @@ describe('pages/clientDB/unicloud-db-demo/unicloud-db-demo', () => {
...
@@ -82,7 +69,6 @@ describe('pages/clientDB/unicloud-db-demo/unicloud-db-demo', () => {
const
addText
=
await
page
.
data
(
'
pageData
'
)
const
addText
=
await
page
.
data
(
'
pageData
'
)
return
addText
===
'
add
'
return
addText
===
'
add
'
})
})
if
(
isAdd
){
//加载更多
if
(
isAdd
){
//加载更多
/* if (process.env.UNI_PLATFORM === "mp-weixin") {
/* if (process.env.UNI_PLATFORM === "mp-weixin") {
const toLoadMore = await page.$('.toLoadMore')
const toLoadMore = await page.$('.toLoadMore')
...
@@ -93,7 +79,7 @@ describe('pages/clientDB/unicloud-db-demo/unicloud-db-demo', () => {
...
@@ -93,7 +79,7 @@ describe('pages/clientDB/unicloud-db-demo/unicloud-db-demo', () => {
if
(
process
.
env
.
UNI_PLATFORM
===
"
h5
"
||
process
.
env
.
UNI_PLATFORM
.
startsWith
(
"
app
"
))
{
if
(
process
.
env
.
UNI_PLATFORM
===
"
h5
"
||
process
.
env
.
UNI_PLATFORM
.
startsWith
(
"
app
"
))
{
const
loadMore
=
await
page
.
$
(
'
.loadMore
'
)
const
loadMore
=
await
page
.
$
(
'
.loadMore
'
)
console
.
log
(
'
loadMore:
'
,
loadMore
);
console
.
log
(
'
loadMore:
'
,
loadMore
);
await
page
.
waitFor
(
300
)
//
await page.waitFor(300)
await
loadMore
.
tap
()
await
loadMore
.
tap
()
await
page
.
waitFor
(
300
)
await
page
.
waitFor
(
300
)
}
}
...
@@ -104,17 +90,13 @@ describe('pages/clientDB/unicloud-db-demo/unicloud-db-demo', () => {
...
@@ -104,17 +90,13 @@ describe('pages/clientDB/unicloud-db-demo/unicloud-db-demo', () => {
const
numboxMin2
=
await
numBox2
.
$
(
'
.uni-numbox__minus
'
)
const
numboxMin2
=
await
numBox2
.
$
(
'
.uni-numbox__minus
'
)
await
numboxMin2
.
tap
()
await
numboxMin2
.
tap
()
await
page
.
waitFor
(
500
)
await
page
.
waitFor
(
500
)
//减少数据数量,由3页变为2页
//减少数据数量,由3页变为2页
const
pageSizeSubAfter
=
await
page
.
data
(
'
pageSize
'
)
const
pageSizeSubAfter
=
await
page
.
data
(
'
pageSize
'
)
expect
(
pageSizeSubAfter
).
toBeLessThanOrEqual
(
pageSizeSubBefore
);
//小于
expect
(
pageSizeSubAfter
).
toBeLessThanOrEqual
(
pageSizeSubBefore
);
//小于
})
})
it
(
"
设置排序字段-orderBy
"
,
async
()
=>
{
it
(
"
设置排序字段-orderBy
"
,
async
()
=>
{
await
page
.
setData
({
"
orderby
"
:
'
create_date asc
'
})
await
page
.
setData
({
"
orderby
"
:
'
create_date asc
'
})
})
})
it
(
"
是否查询总数据条数
"
,
async
()
=>
{
it
(
"
是否查询总数据条数
"
,
async
()
=>
{
const
swGetcount
=
await
page
.
$
(
'
.switch-getcount
'
)
const
swGetcount
=
await
page
.
$
(
'
.switch-getcount
'
)
await
swGetcount
.
tap
()
await
swGetcount
.
tap
()
...
@@ -123,12 +105,10 @@ describe('pages/clientDB/unicloud-db-demo/unicloud-db-demo', () => {
...
@@ -123,12 +105,10 @@ describe('pages/clientDB/unicloud-db-demo/unicloud-db-demo', () => {
expect
.
assertions
(
1
);
expect
.
assertions
(
1
);
expect
(
getcountBool
).
toBeFalsy
();
expect
(
getcountBool
).
toBeFalsy
();
})
})
it
(
"
指定要查询的字段
"
,
async
()
=>
{
it
(
"
指定要查询的字段
"
,
async
()
=>
{
expect
.
assertions
(
1
);
expect
.
assertions
(
1
);
const
arr
=
[
'
book_id
'
,
'
create_date
'
,
'
quantity
'
]
const
arr
=
[
'
book_id
'
,
'
create_date
'
,
'
quantity
'
]
const
getFields
=
await
page
.
data
(
'
fields
'
)
const
getFields
=
await
page
.
data
(
'
fields
'
)
//expect(getFields).toContain('book_id');
expect
(
getFields
).
toEqual
(
arr
);
expect
(
getFields
).
toEqual
(
arr
);
//指定字段create_date
//指定字段create_date
const
fieldCheckbox
=
await
page
.
$
(
'
.field-checkbox
'
)
const
fieldCheckbox
=
await
page
.
$
(
'
.field-checkbox
'
)
...
@@ -136,5 +116,4 @@ describe('pages/clientDB/unicloud-db-demo/unicloud-db-demo', () => {
...
@@ -136,5 +116,4 @@ describe('pages/clientDB/unicloud-db-demo/unicloud-db-demo', () => {
field
:
[
'
create_date
'
],
field
:
[
'
create_date
'
],
})
})
})
})
})
})
pages/clientDB/unicloud-db-demo/unicloud-db-demo.vue
浏览文件 @
e691801a
...
@@ -208,7 +208,7 @@
...
@@ -208,7 +208,7 @@
success
:
(
res
)
=>
{
// 新增成功后的回调
success
:
(
res
)
=>
{
// 新增成功后的回调
console
.
log
(
"
res.result:
"
,
res
.
result
);
console
.
log
(
"
res.result:
"
,
res
.
result
);
this
.
getFn
()
this
.
getFn
()
return
res
return
res
.
result
}
}
})
})
},
},
...
@@ -221,7 +221,9 @@
...
@@ -221,7 +221,9 @@
return
await
udb
.
update
(
_id
,{
book_id
:
"
这条数据被改
"
},
return
await
udb
.
update
(
_id
,{
book_id
:
"
这条数据被改
"
},
{
{
success
:
(
res
)
=>
{
// 新增成功后的回调
success
:
(
res
)
=>
{
// 新增成功后的回调
return
this
.
getFn
()
console
.
log
(
'
res:
'
,
res
);
this
.
getFn
()
return
res
.
result
}
}
})
})
},
},
...
...
pages/cloudObject/cloudObject.test.js
浏览文件 @
e691801a
...
@@ -33,13 +33,9 @@ describe('pages/cloudObject/cloudObject.vue', () => {
...
@@ -33,13 +33,9 @@ describe('pages/cloudObject/cloudObject.vue', () => {
})
})
it
(
'
查询前10条数据
'
,
async
()
=>
{
it
(
'
查询前10条数据
'
,
async
()
=>
{
//
expect.assertions(1);
expect
.
assertions
(
1
);
const
getTenData
=
await
page
.
callMethod
(
'
get
'
)
const
getTenData
=
await
page
.
callMethod
(
'
get
'
)
console
.
log
(
"
getTenData.data.length:
"
,
getTenData
.
data
.
length
);
// expect(getTenData.length).not.toBeUndefined();
expect
(
getTenData
.
data
.
length
).
toBeGreaterThanOrEqual
(
1
);
expect
(
getTenData
.
data
.
length
).
toBeGreaterThanOrEqual
(
1
);
// expect(getTenData.length).toBeDefined();
})
})
it
(
'
使用公用模块
'
,
async
()
=>
{
it
(
'
使用公用模块
'
,
async
()
=>
{
...
...
pages/storage/storage.test.js
浏览文件 @
e691801a
...
@@ -6,17 +6,13 @@ describe('pages/storage/storage.vue', () => {
...
@@ -6,17 +6,13 @@ describe('pages/storage/storage.vue', () => {
page
=
await
program
.
switchTab
(
'
/pages/storage/storage
'
)
page
=
await
program
.
switchTab
(
'
/pages/storage/storage
'
)
await
page
.
waitFor
(
'
view
'
)
await
page
.
waitFor
(
'
view
'
)
})
})
it
(
'
云存储页-检查标题
'
,
async
()
=>
{
it
(
'
云存储页-检查标题
'
,
async
()
=>
{
//expect.assertions(1);
//expect.assertions(1);
const
content
=
await
page
.
$
(
'
.content
'
)
const
content
=
await
page
.
$
(
'
.content
'
)
const
title
=
await
content
.
$
(
'
.title
'
)
const
title
=
await
content
.
$
(
'
.title
'
)
console
.
log
(
'
content:
'
,
content
,
await
title
.
text
());
expect
(
await
title
.
text
()).
toBe
(
'
直接上传文件到云存储
'
);
expect
(
await
title
.
text
()).
toBe
(
'
直接上传文件到云存储
'
);
})
})
// it('上传文件',async()=>{
// it('上传文件',async()=>{
// const upload = await page.callMethod('upload')
// const upload = await page.callMethod('upload')
// })
// })
})
})
\ No newline at end of file
pages/user-info/add.test.js
浏览文件 @
e691801a
describe
(
'
pages/user-info/add.vue
'
,
()
=>
{
describe
(
'
pages/user-info/add.vue
'
,
()
=>
{
let
page
let
page
beforeAll
(
async
()
=>
{
beforeAll
(
async
()
=>
{
// 重新reLaunch至首页,并获取首页page对象(其中 program 是uni-automator自动注入的全局对象)
// 重新reLaunch至首页,并获取首页page对象(其中 program 是uni-automator自动注入的全局对象)
page
=
await
program
.
reLaunch
(
'
/pages/user-info/add
'
)
page
=
await
program
.
reLaunch
(
'
/pages/user-info/add
'
)
await
page
.
waitFor
(
'
view
'
)
await
page
.
waitFor
(
'
view
'
)
page
=
await
program
.
currentPage
()
})
})
it
(
'
输入表单内容
'
,
async
()
=>
{
it
(
'
输入表单内容
'
,
async
()
=>
{
let
username
=
"
林小明
"
let
username
=
"
林小明
"
let
weight
=
51
let
weight
=
51
let
mobile
=
"
17769516066
"
let
mobile
=
"
17769516066
"
...
@@ -33,26 +29,19 @@ describe('pages/user-info/add.vue', () => {
...
@@ -33,26 +29,19 @@ describe('pages/user-info/add.vue', () => {
"
isTest
"
:
true
"
isTest
"
:
true
})
})
//console.log(await page.data('formData'), "setForm---");
//console.log(await page.data('formData'), "setForm---");
//姓名只能输入中文
//姓名只能输入中文
//expect(username).toMatch(/^[\u4e00-\u9fa5]+/);
//expect(username).toMatch(/^[\u4e00-\u9fa5]+/);
//手机号校验
//手机号校验
expect
(
mobile
).
toMatch
(
/^1
[
3|4|5|7|8
][
0-9
]{9}
$/
);
expect
(
mobile
).
toMatch
(
/^1
[
3|4|5|7|8
][
0-9
]{9}
$/
);
//var re=/\w+@[a-z0-9]+\.[a-z]{2,4}/
//var re=/\w+@[a-z0-9]+\.[a-z]{2,4}/
expect
(
email
).
toMatch
(
/
\w
+@
[
a-z0-9
]
+
\.[
a-z
]{2,4}
/
);
expect
(
email
).
toMatch
(
/
\w
+@
[
a-z0-9
]
+
\.[
a-z
]{2,4}
/
);
//url验证
//url验证
const
urlEx
=
/^
((
ht|f
)
tps
?)
:
\/\/[\w\-]
+
(\.[\w\-]
+
)
+
([\w\-\.
,@?^=%&:
\/
~
\+
#
]
*
[\w\-\@
?^=%&
\/
~
\+
#
])?
$/
;
const
urlEx
=
/^
((
ht|f
)
tps
?)
:
\/\/[\w\-]
+
(\.[\w\-]
+
)
+
([\w\-\.
,@?^=%&:
\/
~
\+
#
]
*
[\w\-\@
?^=%&
\/
~
\+
#
])?
$/
;
expect
(
url
).
toMatch
(
urlEx
);
expect
(
url
).
toMatch
(
urlEx
);
//体重要大于50 小于或等于500
//体重要大于50 小于或等于500
expect
(
weight
).
toBeGreaterThan
(
50
)
expect
(
weight
).
toBeGreaterThan
(
50
)
expect
(
weight
).
toBeLessThanOrEqual
(
500
)
expect
(
weight
).
toBeLessThanOrEqual
(
500
)
const
subRes
=
await
page
.
callMethod
(
'
submit
'
)
await
page
.
callMethod
(
'
submit
'
)
console
.
log
(
"
subRes:
"
,
subRes
);
})
})
})
})
\ No newline at end of file
pages/user-info/add.vue
浏览文件 @
e691801a
...
@@ -127,13 +127,11 @@
...
@@ -127,13 +127,11 @@
})
})
return
this
.
$refs
.
form
.
validate
().
then
(
async
(
res
)
=>
{
return
this
.
$refs
.
form
.
validate
().
then
(
async
(
res
)
=>
{
console
.
log
(
'
res:
'
,
res
);
console
.
log
(
'
res:
'
,
res
);
await
this
.
submitForm
(
res
)
return
await
this
.
submitForm
(
res
)
return
res
}).
catch
(()
=>
{
}).
catch
(()
=>
{
uni
.
hideLoading
()
uni
.
hideLoading
()
})
})
},
},
async
submitForm
(
value
)
{
async
submitForm
(
value
)
{
// 使用 clientDB 提交数据
// 使用 clientDB 提交数据
return
await
db
.
collection
(
dbCollectionName
).
add
(
value
).
then
((
res
)
=>
{
return
await
db
.
collection
(
dbCollectionName
).
add
(
value
).
then
((
res
)
=>
{
...
...
pages/validate-demo/add.test.js
浏览文件 @
e691801a
describe
(
'
pages/validate-demo/add.vue
'
,
()
=>
{
describe
(
'
pages/validate-demo/add.vue
'
,
()
=>
{
let
page
let
page
beforeAll
(
async
()
=>
{
beforeAll
(
async
()
=>
{
// 重新reLaunch至首页,并获取首页page对象(其中 program 是uni-automator自动注入的全局对象)
// 重新reLaunch至首页,并获取首页page对象(其中 program 是uni-automator自动注入的全局对象)
page
=
await
program
.
reLaunch
(
'
/pages/validate-demo/add
'
)
page
=
await
program
.
reLaunch
(
'
/pages/validate-demo/add
'
)
await
page
.
waitFor
(
'
view
'
)
await
page
.
waitFor
(
'
view
'
)
page
=
await
program
.
currentPage
()
})
})
it
(
'
输入表单内容
'
,
async
()
=>
{
it
(
'
输入表单内容
'
,
async
()
=>
{
let
type
=
1
let
type
=
1
let
type_name
=
"
数字天堂
"
let
type_name
=
"
数字天堂
"
let
comment
=
"
我是备注消息
"
let
comment
=
"
我是备注消息
"
...
@@ -32,8 +28,7 @@ describe('pages/validate-demo/add.vue', () => {
...
@@ -32,8 +28,7 @@ describe('pages/validate-demo/add.vue', () => {
"
address
"
:
"
110108
"
"
address
"
:
"
110108
"
}
}
})
})
// console.log(await page.data('formData'), "setForm---");
console
.
log
(
await
page
.
data
(
'
formData
'
),
"
setForm---
"
);
//姓名只能输入中文
//姓名只能输入中文
//expect(username).toMatch(/\u4e00-\u9fa5/);
//expect(username).toMatch(/\u4e00-\u9fa5/);
...
@@ -59,6 +54,7 @@ describe('pages/validate-demo/add.vue', () => {
...
@@ -59,6 +54,7 @@ describe('pages/validate-demo/add.vue', () => {
expect
(
weight
).
toBeGreaterThan
(
50
)
expect
(
weight
).
toBeGreaterThan
(
50
)
expect
(
weight
).
toBeLessThanOrEqual
(
500
)
expect
(
weight
).
toBeLessThanOrEqual
(
500
)
await
page
.
callMethod
(
'
submit
'
)
await
page
.
callMethod
(
'
submit
'
)
await
page
.
waitFor
(
500
)
})
})
})
})
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录