Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
DCloud
hello-uniCloud
提交
aa70ebd2
H
hello-uniCloud
项目概览
DCloud
/
hello-uniCloud
通知
301
Star
4
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看板
提交
aa70ebd2
编写于
11月 20, 2023
作者:
A
Anne_LXM
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
update test
上级
b64a3ee9
变更
2
隐藏空白更改
内联
并排
Showing
2 changed file
with
27 addition
and
80 deletion
+27
-80
pages/clientDB/permission-demo/permission-demo.test.js
pages/clientDB/permission-demo/permission-demo.test.js
+10
-11
pages/clientDB/permission-field-simple/permission-field-simple.test.js
...B/permission-field-simple/permission-field-simple.test.js
+17
-69
未找到文件。
pages/clientDB/permission-demo/permission-demo.test.js
浏览文件 @
aa70ebd2
...
...
@@ -21,24 +21,19 @@ describe('pages/clientDB/permission-demo/permission-demo.vue', () => {
})
it
(
'
未登陆
'
,
async
()
=>
{
await
roles
[
0
].
tap
()
const
unlogin
=
await
page
.
waitFor
(
async
()
=>
{
const
unloginRole
=
await
page
.
data
(
'
rulo_index
'
)
return
unloginRole
===
0
})
const
getData
=
await
page
.
data
(
'
formData
'
)
console
.
log
(
'
rulo_index:
'
,
await
page
.
data
(
'
rulo_index
'
));
expect
(
await
roles
[
0
].
text
()).
toBe
(
'
未登陆
'
)
})
it
(
'
用户
'
,
async
()
=>
{
await
roles
[
1
].
tap
()
const
user
=
await
page
.
waitFor
(
async
()
=>
{
const
userRole
=
await
page
.
data
(
'
rulo_index
'
)
//console.log("userRole: ",userRole);
return
userRole
===
1
})
console
.
log
(
"
user:
"
,
user
);
if
(
user
){
//更新一条数据
const
setDataA
=
await
page
.
setData
({
await
page
.
setData
({
"
formData
"
:
{
"
_id
"
:
"
60200c3554a29f0001d14586
"
,
"
nickname
"
:
"
我是学生
"
,
...
...
@@ -64,7 +59,7 @@ describe('pages/clientDB/permission-demo/permission-demo.vue', () => {
})
if
(
auditor
){
const
setDataB
=
await
page
.
setData
({
await
page
.
setData
({
"
formData
"
:
{
"
_id
"
:
"
60200c3554a29f0001d14586
"
,
"
nickname
"
:
"
我是学生
"
,
...
...
@@ -74,17 +69,21 @@ describe('pages/clientDB/permission-demo/permission-demo.vue', () => {
}
})
}
//console.log(await page.data('formData'), "setDataB-------");
})
it
(
'
管理员
'
,
async
()
=>
{
await
roles
[
3
].
tap
()
const
start
=
Date
.
now
()
const
admin
=
await
page
.
waitFor
(
async
()
=>
{
if
(
Date
.
now
()
-
start
>
4000
){
console
.
warn
(
'
链接服务器超时
'
)
return
true
}
const
adminRole
=
await
page
.
data
(
'
rulo_index
'
)
return
adminRole
===
3
})
if
(
admin
){
const
setDataC
=
await
page
.
setData
({
await
page
.
setData
({
"
formData
"
:
{
"
_id
"
:
"
60200c3554a29f0001d14586
"
,
"
nickname
"
:
"
我是学生
"
,
...
...
pages/clientDB/permission-field-simple/permission-field-simple.test.js
浏览文件 @
aa70ebd2
...
...
@@ -6,17 +6,13 @@ describe('pages/clientDB/permission-field-simple/permission-field-simple.nvue',
'
/pages/clientDB/permission-field-simple/permission-field-simple
'
)
await
page
.
waitFor
(
'
view
'
)
page
=
await
program
.
currentPage
()
errMsgA
=
"
权限校验未通过,参与权限校验的集合:[],请参考文档:https://uniapp.dcloud.net.cn/uniCloud/schema.html#handler-permission-error
"
errMsgB
=
"
权限校验未通过,未能获取当前用户信息,当前用户为匿名身份 ,参与权限校验的集合:[],请参考文档:https://uniapp.dcloud.net.cn/uniCloud/schema.html#handler-permission-error
"
perPage
=
await
page
.
$
(
'
.page
'
)
//头部操作控制条
segItems
=
await
perPage
.
$$
(
'
.segmented-control__item
'
)
//底部角色控制条
roles
=
await
perPage
.
$$
(
'
.roles-item
'
)
})
it
(
'
创建--未登陆
'
,
async
()
=>
{
...
...
@@ -34,8 +30,8 @@ describe('pages/clientDB/permission-field-simple/permission-field-simple.nvue',
const
createUnloginRole
=
await
page
.
data
(
'
currentRole
'
)
return
createUnloginIndex
===
0
&&
createUnloginRole
===
0
})
// console.log("createUnlogin: ",createUnlogin);
if
(
!
createUnlogin
)
return
const
createA
=
await
page
.
callMethod
(
'
myFn
'
,
{
"
type
"
:
"
create
"
,
...
...
@@ -76,23 +72,17 @@ describe('pages/clientDB/permission-field-simple/permission-field-simple.nvue',
})
it
(
'
读取--未登陆
'
,
async
()
=>
{
// const perPage = await page.$('.page')
//头部操作控制条
// const segItems = await perPage.$$('.segmented-control__item')
//底部角色控制条
// const roles = await perPage.$$('.roles-item')
//点击读取
await
segItems
[
1
].
tap
()
await
roles
[
0
].
tap
()
const
readUnlogin
=
await
page
.
waitFor
(
async
()
=>
{
const
readUnloginIndex
=
await
page
.
data
(
'
typeIndex
'
)
const
readUnloginRole
=
await
page
.
data
(
'
currentRole
'
)
return
readUnloginIndex
===
1
&&
readUnloginRole
===
0
})
// console.log("readUnlogin: ",readUnlogin);
if
(
!
readUnlogin
)
return
const
readA
=
await
page
.
callMethod
(
'
myFn
'
,
{
"
type
"
:
"
read
"
,
...
...
@@ -133,11 +123,7 @@ describe('pages/clientDB/permission-field-simple/permission-field-simple.nvue',
})
it
(
'
更新--未登陆
'
,
async
()
=>
{
// const perPage = await page.$('.page')
//头部操作控制条
// const segItems = await perPage.$$('.segmented-control__item')
//底部角色控制条
// const roles = await perPage.$$('.roles-item')
//点击更新
await
segItems
[
2
].
tap
()
await
roles
[
0
].
tap
()
...
...
@@ -148,7 +134,7 @@ describe('pages/clientDB/permission-field-simple/permission-field-simple.nvue',
return
updateUnloginIndex
===
2
&&
updateUnloginRole
===
0
})
// console.log("updateUnlogin: ",updateUnlogin);
if
(
!
updateUnlogin
)
return
const
updateA
=
await
page
.
callMethod
(
'
myFn
'
,
{
"
type
"
:
"
update
"
,
"
index
"
:
0
...
...
@@ -192,12 +178,6 @@ describe('pages/clientDB/permission-field-simple/permission-field-simple.nvue',
it
(
'
创建--用户
'
,
async
()
=>
{
// const perPage = await page.$('.page')
//头部操作控制条
// const segItems = await perPage.$$('.segmented-control__item')
//底部角色控制条
// const roles = await perPage.$$('.roles-item')
//点击创建
await
segItems
[
0
].
tap
()
await
roles
[
1
].
tap
()
...
...
@@ -207,7 +187,7 @@ describe('pages/clientDB/permission-field-simple/permission-field-simple.nvue',
const
createUserRole
=
await
page
.
data
(
'
currentRole
'
)
return
createUserIndex
===
0
&&
createUserRole
==
'
user
'
})
console
.
log
(
"
createUser:
"
,
createUser
);
//
console.log("createUser: ",createUser);
if
(
!
createUser
)
return
const
createUserA
=
await
page
.
callMethod
(
'
myFn
'
,
{
...
...
@@ -262,7 +242,7 @@ describe('pages/clientDB/permission-field-simple/permission-field-simple.nvue',
const
readUserRole
=
await
page
.
data
(
'
currentRole
'
)
return
readUserIndex
===
1
&&
readUserRole
==
'
user
'
})
if
(
!
readUser
)
return
// console.log("readUser: ",readUser);
const
readUserA
=
await
page
.
callMethod
(
'
myFn
'
,
{
...
...
@@ -303,11 +283,6 @@ describe('pages/clientDB/permission-field-simple/permission-field-simple.nvue',
})
it
(
'
更新--用户
'
,
async
()
=>
{
// const perPage = await page.$('.page')
//头部操作控制条
// const segItems = await perPage.$$('.segmented-control__item')
//底部角色控制条
// const roles = await perPage.$$('.roles-item')
//点击更新
await
segItems
[
2
].
tap
()
await
roles
[
1
].
tap
()
...
...
@@ -317,7 +292,6 @@ describe('pages/clientDB/permission-field-simple/permission-field-simple.nvue',
const
updateUserRole
=
await
page
.
data
(
'
currentRole
'
)
return
updateUserIndex
===
2
&&
updateUserRole
==
'
user
'
})
if
(
readUser
){
const
updateUserA
=
await
page
.
callMethod
(
'
myFn
'
,
{
"
type
"
:
"
update
"
,
...
...
@@ -359,12 +333,6 @@ describe('pages/clientDB/permission-field-simple/permission-field-simple.nvue',
it
(
'
创建--审核员
'
,
async
()
=>
{
// const perPage = await page.$('.page')
//头部操作控制条
// const segItems = await perPage.$$('.segmented-control__item')
//底部角色控制条
// const roles = await perPage.$$('.roles-item')
//点击创建
await
segItems
[
0
].
tap
()
await
roles
[
2
].
tap
()
...
...
@@ -374,7 +342,7 @@ describe('pages/clientDB/permission-field-simple/permission-field-simple.nvue',
const
createAuditorRole
=
await
page
.
data
(
'
currentRole
'
)
return
createAuditorIndex
===
0
&&
createAuditorRole
==
'
auditor
'
})
if
(
!
createAuditor
)
return
const
createAuditorA
=
await
page
.
callMethod
(
'
myFn
'
,
{
"
type
"
:
"
create
"
,
"
index
"
:
0
,
...
...
@@ -414,11 +382,6 @@ describe('pages/clientDB/permission-field-simple/permission-field-simple.nvue',
})
it
(
'
读取--审核员
'
,
async
()
=>
{
// const perPage = await page.$('.page')
//头部操作控制条
// const segItems = await perPage.$$('.segmented-control__item')
//底部角色控制条
// const roles = await perPage.$$('.roles-item')
//点击读取
await
segItems
[
1
].
tap
()
await
roles
[
2
].
tap
()
...
...
@@ -428,7 +391,7 @@ describe('pages/clientDB/permission-field-simple/permission-field-simple.nvue',
const
readAuditorRole
=
await
page
.
data
(
'
currentRole
'
)
return
readAuditorIndex
===
1
&&
readAuditorRole
==
'
auditor
'
})
if
(
!
readAuditor
)
return
const
readAuditorA
=
await
page
.
callMethod
(
'
myFn
'
,
{
"
type
"
:
"
read
"
,
"
index
"
:
0
...
...
@@ -465,11 +428,6 @@ describe('pages/clientDB/permission-field-simple/permission-field-simple.nvue',
})
it
(
'
更新--审核员
'
,
async
()
=>
{
// const perPage = await page.$('.page')
//头部操作控制条
// const segItems = await perPage.$$('.segmented-control__item')
//底部角色控制条
// const roles = await perPage.$$('.roles-item')
//点击更新
await
segItems
[
2
].
tap
()
await
roles
[
2
].
tap
()
...
...
@@ -479,7 +437,8 @@ describe('pages/clientDB/permission-field-simple/permission-field-simple.nvue',
const
updateAuditorRole
=
await
page
.
data
(
'
currentRole
'
)
return
updateAuditorIndex
===
2
&&
updateAuditorRole
==
'
auditor
'
})
console
.
log
(
'
updateAuditor:
'
,
updateAuditor
);
// console.log('updateAuditor: ',updateAuditor);
if
(
!
updateAuditor
)
return
const
updateAuditorA
=
await
page
.
callMethod
(
'
myFn
'
,
{
"
type
"
:
"
update
"
,
...
...
@@ -519,11 +478,6 @@ describe('pages/clientDB/permission-field-simple/permission-field-simple.nvue',
it
(
'
创建--管理员
'
,
async
()
=>
{
// const perPage = await page.$('.page')
//头部操作控制条
// const segItems = await perPage.$$('.segmented-control__item')
//底部角色控制条
// const roles = await perPage.$$('.roles-item')
//点击创建
await
segItems
[
0
].
tap
()
await
roles
[
3
].
tap
()
...
...
@@ -533,7 +487,8 @@ describe('pages/clientDB/permission-field-simple/permission-field-simple.nvue',
const
createAdminRole
=
await
page
.
data
(
'
currentRole
'
)
return
createAdminIndex
===
0
&&
createAdminRole
==
'
admin
'
})
console
.
log
(
'
createAdmin:
'
,
createAdmin
);
// console.log('createAdmin: ',createAdmin);
if
(
!
createAdmin
)
return
await
page
.
callMethod
(
'
myFn
'
,
{
"
type
"
:
"
create
"
,
...
...
@@ -571,11 +526,6 @@ describe('pages/clientDB/permission-field-simple/permission-field-simple.nvue',
})
it
(
'
读取--管理员
'
,
async
()
=>
{
// const perPage = await page.$('.page')
//头部操作控制条
// const segItems = await perPage.$$('.segmented-control__item')
//底部角色控制条
// const roles = await perPage.$$('.roles-item')
//点击读取
await
segItems
[
1
].
tap
()
await
roles
[
3
].
tap
()
...
...
@@ -585,7 +535,8 @@ describe('pages/clientDB/permission-field-simple/permission-field-simple.nvue',
const
readAdminRole
=
await
page
.
data
(
'
currentRole
'
)
return
readAdminIndex
===
1
&&
readAdminRole
==
'
admin
'
})
console
.
log
(
'
readAdmin:
'
,
readAdmin
);
// console.log('readAdmin: ',readAdmin);
if
(
!
readAdmin
)
return
await
page
.
callMethod
(
'
myFn
'
,
{
"
type
"
:
"
read
"
,
...
...
@@ -623,11 +574,6 @@ describe('pages/clientDB/permission-field-simple/permission-field-simple.nvue',
})
it
(
'
更新--管理员
'
,
async
()
=>
{
// const perPage = await page.$('.page')
//头部操作控制条
// const segItems = await perPage.$$('.segmented-control__item')
//底部角色控制条
// const roles = await perPage.$$('.roles-item')
//点击更新
await
segItems
[
2
].
tap
()
await
roles
[
3
].
tap
()
...
...
@@ -637,7 +583,9 @@ describe('pages/clientDB/permission-field-simple/permission-field-simple.nvue',
const
updateAdminRole
=
await
page
.
data
(
'
currentRole
'
)
return
updateAdminIndex
===
2
&&
updateAdminRole
==
'
admin
'
})
console
.
log
(
'
updateAdmin:
'
,
updateAdmin
);
// console.log('updateAdmin: ',updateAdmin);
if
(
!
updateAdmin
)
return
await
page
.
callMethod
(
'
myFn
'
,
{
"
type
"
:
"
update
"
,
"
index
"
:
0
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录