Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
DCloud
hello-uniCloud
提交
f39a22c1
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看板
提交
f39a22c1
编写于
11月 21, 2023
作者:
A
Anne_LXM
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
update test
上级
c2983695
变更
9
隐藏空白更改
内联
并排
Showing
9 changed file
with
34 addition
and
458 deletion
+34
-458
jest.config.js
jest.config.js
+2
-33
manifest.json
manifest.json
+1
-1
pages/clientDB/clientDB-api/clientDB-api.test.js
pages/clientDB/clientDB-api/clientDB-api.test.js
+0
-3
pages/clientDB/permission-demo/permission-demo.test.js
pages/clientDB/permission-demo/permission-demo.test.js
+1
-2
pages/clientDB/permission-field-simple/permission-field-simple.test.js
...B/permission-field-simple/permission-field-simple.test.js
+3
-43
pages/clientDB/permission-table-compound/permission-table-compound.test.js
...rmission-table-compound/permission-table-compound.test.js
+4
-180
pages/clientDB/permission-table-simple/permission-table-simple.test.js
...B/permission-table-simple/permission-table-simple.test.js
+19
-187
pages/clientDB/unicloud-db-demo/unicloud-db-demo.test.js
pages/clientDB/unicloud-db-demo/unicloud-db-demo.test.js
+4
-8
pages/clientDB/validate/validate.test.js
pages/clientDB/validate/validate.test.js
+0
-1
未找到文件。
jest.config.js
浏览文件 @
f39a22c1
module
.
exports
=
{
testEnvironmentOptions
:
{
compile
:
true
,
h5
:
{
options
:
{
headless
:
false
// 配置是否显示 puppeteer 测试窗口
}
},
"
mp-weixin
"
:
{
port
:
9420
,
// 默认 9420
account
:
""
,
// 测试账号
args
:
""
,
// 指定开发者工具参数cnpm
cwd
:
""
,
// 指定开发者工具工作目录
launch
:
true
,
// 是否主动拉起开发者工具
teardown
:
"
disconnect
"
,
// 可选值 "disconnect"|"close" 运行测试结束后,断开开发者工具或关闭开发者工具
remote
:
false
,
// 是否真机自动化测试
executablePath
:
"
C:/Users/liuxi/download/微信web开发者工具/cli.bat
"
,
// 开发者工具cli路径,默认会自动查找
},
"
app-plus
"
:
{
// 需要安装 HBuilderX
android
:
{
executablePath
:
"
D:/HX/alpha/HBuilderX/plugins/launcher/base/android_base.apk
"
// apk 目录
},
/* ios: {
id: "",
executablePath: "HBuilderX/plugins/launcher/base/Pandora_simulator.app" // ipa 目录
} */
}
},
collectCoverage
:
true
,
collectCoverageFrom
:
[
"
src/**/*.{js,vue}
"
],
testTimeout
:
10000
,
reporters
:
[
'
default
'
],
testTimeout
:
30000
,
reporters
:
[
'
default
'
],
watchPathIgnorePatterns
:
[
'
/node_modules/
'
,
'
/dist/
'
,
'
/.git/
'
],
moduleFileExtensions
:
[
'
js
'
,
'
json
'
],
rootDir
:
__dirname
,
...
...
manifest.json
浏览文件 @
f39a22c1
...
...
@@ -56,7 +56,7 @@
},
"quickapp"
:
{},
"mp-weixin"
:
{
"appid"
:
""
,
"appid"
:
"
wx999bf02c8e05dfc9
"
,
"setting"
:
{
"urlCheck"
:
false
,
"es6"
:
false
...
...
pages/clientDB/clientDB-api/clientDB-api.test.js
浏览文件 @
f39a22c1
describe
(
'
pages/clientDB/clientDB-api/clientDB-api.nvue
'
,
()
=>
{
let
page
beforeAll
(
async
()
=>
{
// 重新reLaunch至首页,并获取首页page对象(其中 program 是uni-automator自动注入的全局对象)
page
=
await
program
.
reLaunch
(
'
/pages/clientDB/clientDB-api/clientDB-api
'
)
await
page
.
waitFor
(
"
view
"
)
page
=
await
program
.
currentPage
()
})
it
(
'
查图书book表的数据
'
,
async
()
=>
{
expect
.
assertions
(
1
);
...
...
@@ -17,7 +15,6 @@ describe('pages/clientDB/clientDB-api/clientDB-api.nvue', () => {
const
orderData
=
await
page
.
callMethod
(
'
getData
'
,
'
order
'
)
expect
(
orderData
.
length
).
not
.
toBeUndefined
();
})
it
(
'
分页查图书book表的数据
'
,
async
()
=>
{
//expect.assertions(1);
//获取页码
...
...
pages/clientDB/permission-demo/permission-demo.test.js
浏览文件 @
f39a22c1
...
...
@@ -42,8 +42,7 @@ describe('pages/clientDB/permission-demo/permission-demo.vue', () => {
"
phone
"
:
"
18890903030
"
}
})
const
perPagea
=
await
page
.
$
(
'
.page
'
)
const
buttonGroup
=
await
perPagea
.
$
(
'
.uni-button-group
'
)
const
buttonGroup
=
await
perPage
.
$
(
'
.uni-button-group
'
)
const
toButton
=
await
buttonGroup
.
$
(
'
.uni-button
'
)
await
toButton
.
tap
()
await
page
.
waitFor
(
800
)
...
...
pages/clientDB/permission-field-simple/permission-field-simple.test.js
浏览文件 @
f39a22c1
...
...
@@ -16,12 +16,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
[
0
].
tap
()
...
...
@@ -31,7 +25,6 @@ describe('pages/clientDB/permission-field-simple/permission-field-simple.nvue',
return
createUnloginIndex
===
0
&&
createUnloginRole
===
0
})
// console.log("createUnlogin: ",createUnlogin);
if
(
!
createUnlogin
)
return
const
createA
=
await
page
.
callMethod
(
'
myFn
'
,
{
"
type
"
:
"
create
"
,
...
...
@@ -68,11 +61,9 @@ describe('pages/clientDB/permission-field-simple/permission-field-simple.nvue',
"
index
"
:
2
,
"
field
"
:
"
_id,state,create_time,text
"
,
})
})
it
(
'
读取--未登陆
'
,
async
()
=>
{
//点击读取
await
segItems
[
1
].
tap
()
await
roles
[
0
].
tap
()
...
...
@@ -82,7 +73,6 @@ describe('pages/clientDB/permission-field-simple/permission-field-simple.nvue',
return
readUnloginIndex
===
1
&&
readUnloginRole
===
0
})
// console.log("readUnlogin: ",readUnlogin);
if
(
!
readUnlogin
)
return
const
readA
=
await
page
.
callMethod
(
'
myFn
'
,
{
"
type
"
:
"
read
"
,
...
...
@@ -123,8 +113,6 @@ describe('pages/clientDB/permission-field-simple/permission-field-simple.nvue',
})
it
(
'
更新--未登陆
'
,
async
()
=>
{
//点击更新
await
segItems
[
2
].
tap
()
await
roles
[
0
].
tap
()
...
...
@@ -134,7 +122,6 @@ 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
...
...
@@ -152,7 +139,6 @@ describe('pages/clientDB/permission-field-simple/permission-field-simple.nvue',
"
type
"
:
"
update
"
,
"
index
"
:
1
})
// expect(updateB).toBe('未能获取当前用户信息:30205 | 当前用户为匿名身份')
expect
(
updateB
).
toBe
(
errMsgB
)
await
page
.
callMethod
(
'
myFn
'
,
{
...
...
@@ -172,11 +158,8 @@ describe('pages/clientDB/permission-field-simple/permission-field-simple.nvue',
"
index
"
:
2
,
"
field
"
:
"
_id,state,create_time,text
"
})
})
it
(
'
创建--用户
'
,
async
()
=>
{
//点击创建
await
segItems
[
0
].
tap
()
...
...
@@ -188,7 +171,6 @@ describe('pages/clientDB/permission-field-simple/permission-field-simple.nvue',
return
createUserIndex
===
0
&&
createUserRole
==
'
user
'
})
// console.log("createUser: ",createUser);
if
(
!
createUser
)
return
const
createUserA
=
await
page
.
callMethod
(
'
myFn
'
,
{
"
type
"
:
"
create
"
,
...
...
@@ -217,8 +199,8 @@ describe('pages/clientDB/permission-field-simple/permission-field-simple.nvue',
"
type
"
:
"
create
"
,
"
index
"
:
2
,
})
console
.
log
(
'
createUserB:
'
,
createUserB
);
// expect(createUserB).toBe('[permission-test-12.ip.write]权限校验未通过')
//未能获取当前用户信息:30205 | 当前用户为匿名身份
await
page
.
callMethod
(
'
myFn
'
,
{
"
type
"
:
"
create
"
,
"
index
"
:
2
,
...
...
@@ -228,12 +210,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
[
1
].
tap
()
...
...
@@ -242,7 +218,6 @@ 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
'
,
{
...
...
@@ -283,7 +258,6 @@ describe('pages/clientDB/permission-field-simple/permission-field-simple.nvue',
})
it
(
'
更新--用户
'
,
async
()
=>
{
//点击更新
await
segItems
[
2
].
tap
()
await
roles
[
1
].
tap
()
...
...
@@ -331,7 +305,6 @@ describe('pages/clientDB/permission-field-simple/permission-field-simple.nvue',
})
it
(
'
创建--审核员
'
,
async
()
=>
{
//点击创建
await
segItems
[
0
].
tap
()
...
...
@@ -342,13 +315,11 @@ 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
,
})
// console.log("createAuditorA: ",createAuditorA);
// expect(createAuditorA).toBe('[permission-test-10.ip.write]权限校验未通过')
expect
(
createAuditorA
).
toBe
(
errMsgA
)
await
page
.
callMethod
(
'
myFn
'
,
{
...
...
@@ -382,7 +353,6 @@ describe('pages/clientDB/permission-field-simple/permission-field-simple.nvue',
})
it
(
'
读取--审核员
'
,
async
()
=>
{
//点击读取
await
segItems
[
1
].
tap
()
await
roles
[
2
].
tap
()
...
...
@@ -391,7 +361,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
...
...
@@ -428,7 +398,6 @@ describe('pages/clientDB/permission-field-simple/permission-field-simple.nvue',
})
it
(
'
更新--审核员
'
,
async
()
=>
{
//点击更新
await
segItems
[
2
].
tap
()
await
roles
[
2
].
tap
()
...
...
@@ -438,7 +407,6 @@ describe('pages/clientDB/permission-field-simple/permission-field-simple.nvue',
return
updateAuditorIndex
===
2
&&
updateAuditorRole
==
'
auditor
'
})
// console.log('updateAuditor: ',updateAuditor);
if
(
!
updateAuditor
)
return
const
updateAuditorA
=
await
page
.
callMethod
(
'
myFn
'
,
{
"
type
"
:
"
update
"
,
...
...
@@ -473,12 +441,9 @@ describe('pages/clientDB/permission-field-simple/permission-field-simple.nvue',
"
index
"
:
2
,
"
field
"
:
"
_id,state,create_time,text
"
})
})
it
(
'
创建--管理员
'
,
async
()
=>
{
//点击创建
await
segItems
[
0
].
tap
()
await
roles
[
3
].
tap
()
...
...
@@ -488,7 +453,6 @@ describe('pages/clientDB/permission-field-simple/permission-field-simple.nvue',
return
createAdminIndex
===
0
&&
createAdminRole
==
'
admin
'
})
// console.log('createAdmin: ',createAdmin);
if
(
!
createAdmin
)
return
await
page
.
callMethod
(
'
myFn
'
,
{
"
type
"
:
"
create
"
,
...
...
@@ -526,7 +490,6 @@ describe('pages/clientDB/permission-field-simple/permission-field-simple.nvue',
})
it
(
'
读取--管理员
'
,
async
()
=>
{
//点击读取
await
segItems
[
1
].
tap
()
await
roles
[
3
].
tap
()
...
...
@@ -536,7 +499,6 @@ describe('pages/clientDB/permission-field-simple/permission-field-simple.nvue',
return
readAdminIndex
===
1
&&
readAdminRole
==
'
admin
'
})
// console.log('readAdmin: ',readAdmin);
if
(
!
readAdmin
)
return
await
page
.
callMethod
(
'
myFn
'
,
{
"
type
"
:
"
read
"
,
...
...
@@ -574,7 +536,6 @@ describe('pages/clientDB/permission-field-simple/permission-field-simple.nvue',
})
it
(
'
更新--管理员
'
,
async
()
=>
{
//点击更新
await
segItems
[
2
].
tap
()
await
roles
[
3
].
tap
()
...
...
@@ -584,7 +545,6 @@ describe('pages/clientDB/permission-field-simple/permission-field-simple.nvue',
return
updateAdminIndex
===
2
&&
updateAdminRole
==
'
admin
'
})
// console.log('updateAdmin: ',updateAdmin);
if
(
!
updateAdmin
)
return
await
page
.
callMethod
(
'
myFn
'
,
{
"
type
"
:
"
update
"
,
...
...
pages/clientDB/permission-table-compound/permission-table-compound.test.js
浏览文件 @
f39a22c1
...
...
@@ -21,24 +21,15 @@ describe('pages/clientDB/permission-table-compound/permission-table-compound.vue
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
[
0
].
tap
()
const
createUnlogin
=
await
page
.
waitFor
(
async
()
=>
{
const
createUnloginIndex
=
await
page
.
data
(
'
typeIndex
'
)
const
createUnloginRole
=
await
page
.
data
(
'
currentRole
'
)
return
createUnloginIndex
===
0
&&
createUnloginRole
===
0
})
const
createA
=
await
page
.
callMethod
(
'
myFn
'
,
{
"
type
"
:
"
create
"
,
"
index
"
:
1
...
...
@@ -51,17 +42,9 @@ describe('pages/clientDB/permission-table-compound/permission-table-compound.vue
"
action
"
:
"
add_view_count
"
})
})
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
()
...
...
@@ -71,9 +54,6 @@ describe('pages/clientDB/permission-table-compound/permission-table-compound.vue
return
readUnloginIndex
===
1
&&
readUnloginRole
===
0
})
await
page
.
callMethod
(
'
myFn
'
,
{
"
type
"
:
"
create
"
,
"
index
"
:
0
...
...
@@ -107,13 +87,6 @@ describe('pages/clientDB/permission-table-compound/permission-table-compound.vue
})
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
()
...
...
@@ -123,7 +96,6 @@ describe('pages/clientDB/permission-table-compound/permission-table-compound.vue
return
updateUnloginIndex
===
2
&&
updateUnloginRole
===
0
})
await
page
.
callMethod
(
'
myFn
'
,
{
"
type
"
:
"
create
"
,
"
index
"
:
0
...
...
@@ -154,18 +126,9 @@ describe('pages/clientDB/permission-table-compound/permission-table-compound.vue
"
index
"
:
1
,
"
action
"
:
"
add_view_count
"
})
})
it
(
'
删除--未登陆
'
,
async
()
=>
{
// const perPage = await page.$('.page')
//头部操作控制条
// const segItems = await perPage.$$('.segmented-control__item')
//底部角色控制条
// const roles = await perPage.$$('.roles-item')
//点击删除
await
segItems
[
3
].
tap
()
await
roles
[
0
].
tap
()
...
...
@@ -175,8 +138,6 @@ describe('pages/clientDB/permission-table-compound/permission-table-compound.vue
return
deleteUnloginIndex
===
3
&&
deleteUnloginRole
===
0
})
await
page
.
callMethod
(
'
myFn
'
,
{
"
type
"
:
"
create
"
,
"
index
"
:
0
...
...
@@ -210,16 +171,7 @@ describe('pages/clientDB/permission-table-compound/permission-table-compound.vue
})
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
()
...
...
@@ -229,8 +181,6 @@ describe('pages/clientDB/permission-table-compound/permission-table-compound.vue
return
createUserIndex
===
0
&&
createUserRole
==
'
user
'
})
await
page
.
callMethod
(
'
myFn
'
,
{
"
type
"
:
"
create
"
,
"
index
"
:
1
...
...
@@ -242,17 +192,9 @@ describe('pages/clientDB/permission-table-compound/permission-table-compound.vue
"
action
"
:
"
add_view_count
"
})
})
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
[
1
].
tap
()
...
...
@@ -262,7 +204,6 @@ describe('pages/clientDB/permission-table-compound/permission-table-compound.vue
return
readUserIndex
===
1
&&
readUserRole
==
'
user
'
})
await
page
.
callMethod
(
'
myFn
'
,
{
"
type
"
:
"
create
"
,
"
index
"
:
0
...
...
@@ -273,15 +214,14 @@ describe('pages/clientDB/permission-table-compound/permission-table-compound.vue
"
index
"
:
0
,
"
where
"
:
"
create_time > 1613534788761
"
})
//console.log(readUserA,"readUserA---------");
//未能获取当前用户信息:30205 | 当前用户为匿名身份
console
.
log
(
readUserA
,
"
readUserA---------
"
);
//expect(readUserA).toBe('权限校验未通过')
const
readUserB
=
await
page
.
callMethod
(
'
myFn
'
,
{
"
type
"
:
"
read
"
,
"
index
"
:
0
})
//
console.log(readUserB,"readUserB---------");
console
.
log
(
readUserB
,
"
readUserB---------
"
);
//expect(readUserB).toBe('权限校验未通过')
await
page
.
callMethod
(
'
myFn
'
,
{
...
...
@@ -295,17 +235,9 @@ describe('pages/clientDB/permission-table-compound/permission-table-compound.vue
"
action
"
:
"
add_view_count
"
})
})
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
()
...
...
@@ -316,8 +248,6 @@ describe('pages/clientDB/permission-table-compound/permission-table-compound.vue
return
updateUserIndex
===
2
&&
updateUserRole
==
'
user
'
})
await
page
.
callMethod
(
'
myFn
'
,
{
"
type
"
:
"
create
"
,
"
index
"
:
0
...
...
@@ -328,10 +258,8 @@ describe('pages/clientDB/permission-table-compound/permission-table-compound.vue
"
index
"
:
0
,
"
where
"
:
"
create_time > 1613534788761
"
})
//
console.log(updateUserA,"updateUserA---------");
console
.
log
(
updateUserA
,
"
updateUserA---------
"
);
//expect(updateUserA).toBe('权限校验未通过')
//未能获取当前用户信息:30205 | 当前用户为匿名身份
const
updateUserB
=
await
page
.
callMethod
(
'
myFn
'
,
{
"
type
"
:
"
update
"
,
...
...
@@ -350,17 +278,9 @@ describe('pages/clientDB/permission-table-compound/permission-table-compound.vue
"
action
"
:
"
add_view_count
"
})
})
it
(
'
删除--用户
'
,
async
()
=>
{
// const perPage = await page.$('.page')
//头部操作控制条
// const segItems = await perPage.$$('.segmented-control__item')
//底部角色控制条
// const roles = await perPage.$$('.roles-item')
//点击删除
await
segItems
[
3
].
tap
()
await
roles
[
1
].
tap
()
...
...
@@ -371,7 +291,6 @@ describe('pages/clientDB/permission-table-compound/permission-table-compound.vue
return
deleteUserIndex
===
3
&&
deleteUserRole
==
'
user
'
})
await
page
.
callMethod
(
'
myFn
'
,
{
"
type
"
:
"
create
"
,
"
index
"
:
0
...
...
@@ -400,28 +319,18 @@ describe('pages/clientDB/permission-table-compound/permission-table-compound.vue
"
index
"
:
1
,
"
action
"
:
"
add_view_count
"
})
})
})
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
()
const
createAuditor
=
await
page
.
waitFor
(
async
()
=>
{
const
createAuditorIndex
=
await
page
.
data
(
'
typeIndex
'
)
const
createAuditorRole
=
await
page
.
data
(
'
currentRole
'
)
return
createAuditorIndex
===
0
&&
createAuditorRole
==
'
auditor
'
})
await
page
.
callMethod
(
'
myFn
'
,
{
"
type
"
:
"
create
"
,
"
index
"
:
1
...
...
@@ -433,17 +342,9 @@ describe('pages/clientDB/permission-table-compound/permission-table-compound.vue
"
action
"
:
"
add_view_count
"
})
})
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
()
...
...
@@ -453,7 +354,6 @@ describe('pages/clientDB/permission-table-compound/permission-table-compound.vue
return
readAuditorIndex
===
1
&&
readAuditorRole
==
'
auditor
'
})
await
page
.
callMethod
(
'
myFn
'
,
{
"
type
"
:
"
create
"
,
"
index
"
:
0
...
...
@@ -470,7 +370,6 @@ describe('pages/clientDB/permission-table-compound/permission-table-compound.vue
"
index
"
:
0
})
await
page
.
callMethod
(
'
myFn
'
,
{
"
type
"
:
"
read
"
,
"
index
"
:
1
...
...
@@ -481,19 +380,9 @@ describe('pages/clientDB/permission-table-compound/permission-table-compound.vue
"
index
"
:
1
,
"
action
"
:
"
add_view_count
"
})
})
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
()
...
...
@@ -503,9 +392,6 @@ describe('pages/clientDB/permission-table-compound/permission-table-compound.vue
return
updateAuditorIndex
===
2
&&
updateAuditorRole
==
'
auditor
'
})
await
page
.
callMethod
(
'
myFn
'
,
{
"
type
"
:
"
create
"
,
"
index
"
:
0
...
...
@@ -517,7 +403,6 @@ describe('pages/clientDB/permission-table-compound/permission-table-compound.vue
"
where
"
:
"
create_time > 1613534788761
"
})
const
updateAuditorA
=
await
page
.
callMethod
(
'
myFn
'
,
{
"
type
"
:
"
update
"
,
"
index
"
:
0
...
...
@@ -535,17 +420,9 @@ describe('pages/clientDB/permission-table-compound/permission-table-compound.vue
"
action
"
:
"
add_view_count
"
})
})
it
(
'
删除--审核员
'
,
async
()
=>
{
// const perPage = await page.$('.page')
//头部操作控制条
// const segItems = await perPage.$$('.segmented-control__item')
//底部角色控制条
// const roles = await perPage.$$('.roles-item')
//点击删除
await
segItems
[
3
].
tap
()
await
roles
[
2
].
tap
()
...
...
@@ -555,7 +432,6 @@ describe('pages/clientDB/permission-table-compound/permission-table-compound.vue
return
deleteAuditorIndex
===
3
&&
deleteAuditorRole
==
'
auditor
'
})
await
page
.
callMethod
(
'
myFn
'
,
{
"
type
"
:
"
create
"
,
"
index
"
:
0
...
...
@@ -567,7 +443,6 @@ describe('pages/clientDB/permission-table-compound/permission-table-compound.vue
"
where
"
:
"
create_time > 1613534788761
"
})
const
deleteAuditorB
=
await
page
.
callMethod
(
'
myFn
'
,
{
"
type
"
:
"
delete
"
,
"
index
"
:
0
...
...
@@ -584,21 +459,9 @@ describe('pages/clientDB/permission-table-compound/permission-table-compound.vue
"
index
"
:
1
,
"
action
"
:
"
add_view_count
"
})
})
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
()
...
...
@@ -608,7 +471,6 @@ describe('pages/clientDB/permission-table-compound/permission-table-compound.vue
return
createAdminIndex
===
0
&&
createAdminRole
==
'
admin
'
})
await
page
.
callMethod
(
'
myFn
'
,
{
"
type
"
:
"
create
"
,
"
index
"
:
1
...
...
@@ -620,18 +482,9 @@ describe('pages/clientDB/permission-table-compound/permission-table-compound.vue
"
action
"
:
"
add_view_count
"
})
})
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
()
...
...
@@ -641,7 +494,6 @@ describe('pages/clientDB/permission-table-compound/permission-table-compound.vue
return
readAdminIndex
===
1
&&
readAdminRole
===
'
admin
'
})
await
page
.
callMethod
(
'
myFn
'
,
{
"
type
"
:
"
create
"
,
"
index
"
:
0
...
...
@@ -657,8 +509,6 @@ describe('pages/clientDB/permission-table-compound/permission-table-compound.vue
"
type
"
:
"
read
"
,
"
index
"
:
0
})
await
page
.
callMethod
(
'
myFn
'
,
{
"
type
"
:
"
read
"
,
"
index
"
:
1
...
...
@@ -670,17 +520,9 @@ describe('pages/clientDB/permission-table-compound/permission-table-compound.vue
"
action
"
:
"
add_view_count
"
})
})
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
()
...
...
@@ -690,7 +532,6 @@ describe('pages/clientDB/permission-table-compound/permission-table-compound.vue
return
updateAdminIndex
===
2
&&
updateAdminRole
==
'
admin
'
})
await
page
.
callMethod
(
'
myFn
'
,
{
"
type
"
:
"
create
"
,
"
index
"
:
0
...
...
@@ -718,18 +559,9 @@ describe('pages/clientDB/permission-table-compound/permission-table-compound.vue
"
action
"
:
"
add_view_count
"
})
})
it
(
'
删除--管理员
'
,
async
()
=>
{
// const perPage = await page.$('.page')
//头部操作控制条
// const segItems = await perPage.$$('.segmented-control__item')
//底部角色控制条
// const roles = await perPage.$$('.roles-item')
//点击删除
await
segItems
[
3
].
tap
()
await
roles
[
3
].
tap
()
...
...
@@ -739,7 +571,6 @@ describe('pages/clientDB/permission-table-compound/permission-table-compound.vue
return
deleteAdminIndex
===
3
&&
deleteAdminRole
==
'
admin
'
})
await
page
.
callMethod
(
'
myFn
'
,
{
"
type
"
:
"
create
"
,
"
index
"
:
0
...
...
@@ -751,13 +582,11 @@ describe('pages/clientDB/permission-table-compound/permission-table-compound.vue
"
where
"
:
"
create_time > 1613534788761
"
})
await
page
.
callMethod
(
'
myFn
'
,
{
"
type
"
:
"
delete
"
,
"
index
"
:
0
})
await
page
.
callMethod
(
'
myFn
'
,
{
"
type
"
:
"
delete
"
,
"
index
"
:
1
...
...
@@ -768,11 +597,6 @@ describe('pages/clientDB/permission-table-compound/permission-table-compound.vue
"
index
"
:
1
,
"
action
"
:
"
add_view_count
"
})
})
})
pages/clientDB/permission-table-simple/permission-table-simple.test.js
浏览文件 @
f39a22c1
...
...
@@ -20,12 +20,6 @@ describe('pages/clientDB/permission-table-simple/permission-table-simple.vue', (
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
[
0
].
tap
()
...
...
@@ -33,10 +27,6 @@ describe('pages/clientDB/permission-table-simple/permission-table-simple.vue', (
const
createUnlogin
=
await
page
.
waitFor
(
async
()
=>
{
const
createUnlogintIndex
=
await
page
.
data
(
'
typeIndex
'
)
const
createUnloginRole
=
await
page
.
data
(
'
currentRole
'
)
// console.log({
// createUnlogintIndex,
// createUnloginRole
// });
return
createUnlogintIndex
===
0
&&
createUnloginRole
===
0
})
console
.
log
(
createUnlogin
,
"
创建--未登陆
"
);
...
...
@@ -89,16 +79,9 @@ describe('pages/clientDB/permission-table-simple/permission-table-simple.vue', (
})
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
'
)
...
...
@@ -106,15 +89,14 @@ describe('pages/clientDB/permission-table-simple/permission-table-simple.vue', (
})
//console.log(readUnlogin, '读取--未登陆');
if
(
readUnlogin
)
{
// 含义解释:允许任何角色【读取】
const
readA
=
await
page
.
callMethod
(
'
myFn
'
,
{
"
type
"
:
"
read
"
,
"
index
"
:
0
})
//
console.log('readA: ',readA);
expect
(
readA
.
success
).
toBeTruthy
()
console
.
log
(
'
readA:
'
,
readA
);
//
expect(readA.success).toBeTruthy()
// 禁止任何角色读取
const
readB
=
await
page
.
callMethod
(
'
myFn
'
,
{
...
...
@@ -206,13 +188,6 @@ describe('pages/clientDB/permission-table-simple/permission-table-simple.vue', (
})
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
()
...
...
@@ -223,9 +198,7 @@ describe('pages/clientDB/permission-table-simple/permission-table-simple.vue', (
})
//console.log(updateUnlogin, '更新--未登陆');
if
(
updateUnlogin
)
{
// 允许任何角色更新此表
const
updateA
=
await
page
.
callMethod
(
'
myFn
'
,
{
"
type
"
:
"
update
"
,
...
...
@@ -269,7 +242,8 @@ describe('pages/clientDB/permission-table-simple/permission-table-simple.vue', (
"
type
"
:
"
update
"
,
"
index
"
:
3
})
expect
(
updateF
.
result
.
updated
).
toBe
(
0
)
console
.
log
(
'
updateF:
'
,
updateF
);
// expect(updateF.result.updated).toBe(0)
// 只更新1分钟内创建的数据,先创建数据
const
updateG
=
await
page
.
callMethod
(
'
myFn
'
,
{
...
...
@@ -320,13 +294,6 @@ describe('pages/clientDB/permission-table-simple/permission-table-simple.vue', (
})
it
(
'
删除--未登陆
'
,
async
()
=>
{
// const perPage = await page.$('.page')
//头部操作控制条
// const segItems = await perPage.$$('.segmented-control__item')
//底部角色控制条
// const roles = await perPage.$$('.roles-item')
//点击更新
await
segItems
[
3
].
tap
()
await
roles
[
0
].
tap
()
...
...
@@ -380,9 +347,9 @@ describe('pages/clientDB/permission-table-simple/permission-table-simple.vue', (
"
type
"
:
"
delete
"
,
"
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分钟内创建的数据,先创建数据
const
deleteG
=
await
page
.
callMethod
(
'
myFn
'
,
{
...
...
@@ -431,17 +398,7 @@ describe('pages/clientDB/permission-table-simple/permission-table-simple.vue', (
expect
(
deleteAction
.
result
.
deleted
).
toBe
(
1
)
})
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
()
const
createUser
=
await
page
.
waitFor
(
async
()
=>
{
...
...
@@ -451,7 +408,6 @@ describe('pages/clientDB/permission-table-simple/permission-table-simple.vue', (
})
console
.
log
(
createUser
,
'
创建--用户
'
);
// 任何角色可创建
const
createUserA
=
await
page
.
callMethod
(
'
myFn
'
,
{
"
type
"
:
"
create
"
,
...
...
@@ -498,16 +454,6 @@ describe('pages/clientDB/permission-table-simple/permission-table-simple.vue', (
})
it
(
'
读取--用户
'
,
async
()
=>
{
// const perPage = await page.$('.page')
// console.log('perPage: ',perPage);
//头部操作控制条
// const segItems = await perPage.$$('.segmented-control__item')
// console.log('segItems: ',segItems);
//底部角色控制条
// const roles = await perPage.$$('.roles-item')
// console.log('roles: ',roles);
//点击读取
await
segItems
[
1
].
tap
()
await
roles
[
1
].
tap
()
...
...
@@ -523,7 +469,8 @@ describe('pages/clientDB/permission-table-simple/permission-table-simple.vue', (
"
type
"
:
"
read
"
,
"
index
"
:
0
})
expect
(
readUserA
.
result
.
data
.
length
).
toBeGreaterThan
(
0
)
console
.
log
(
'
readUserA:
'
,
readUserA
);
// expect(readUserA.result.data.length).toBeGreaterThan(0)
// 仅管理员可读
const
readUserB
=
await
page
.
callMethod
(
'
myFn
'
,
{
...
...
@@ -537,6 +484,7 @@ describe('pages/clientDB/permission-table-simple/permission-table-simple.vue', (
"
type
"
:
"
read
"
,
"
index
"
:
2
})
console
.
log
(
'
readUserC:
'
,
readUserC
);
expect
(
readUserC
.
result
.
data
.
length
).
toBeGreaterThan
(
0
)
// 只能读取自己创建的数据,先创建数据
...
...
@@ -552,6 +500,7 @@ describe('pages/clientDB/permission-table-simple/permission-table-simple.vue', (
"
index
"
:
3
,
"
where
"
:
"
uid == $env.uid
"
})
console
.
log
(
'
readUserE:
'
,
readUserE
);
expect
(
readUserE
.
result
.
data
.
length
).
toBeGreaterThan
(
0
)
// 读取全表数据
...
...
@@ -559,6 +508,7 @@ describe('pages/clientDB/permission-table-simple/permission-table-simple.vue', (
"
type
"
:
"
read
"
,
"
index
"
:
3
})
console
.
log
(
'
readUserF:
'
,
readUserF
);
expect
(
readUserF
.
result
.
data
.
length
).
toBeGreaterThan
(
0
)
// 只读取1分钟内创建的数据,先创建数据
...
...
@@ -574,6 +524,7 @@ describe('pages/clientDB/permission-table-simple/permission-table-simple.vue', (
"
index
"
:
4
,
"
where
"
:
"
create_time > 1613541303576
"
})
console
.
log
(
'
readUserH:
'
,
readUserH
);
expect
(
readUserH
.
result
.
data
.
length
).
toBeGreaterThan
(
0
)
// 读取全表数据
...
...
@@ -581,6 +532,7 @@ describe('pages/clientDB/permission-table-simple/permission-table-simple.vue', (
"
type
"
:
"
read
"
,
"
index
"
:
4
})
console
.
log
(
'
readUserI:
'
,
readUserI
);
expect
(
readUserI
.
result
.
data
.
length
).
toBeGreaterThanOrEqual
(
1
)
// 仅审核员读取全表数据
...
...
@@ -603,22 +555,15 @@ describe('pages/clientDB/permission-table-simple/permission-table-simple.vue', (
"
index
"
:
6
,
"
action
"
:
"
add_view_count
"
})
expect
(
readUserO
.
result
.
data
.
length
).
toBeGreaterThan
(
0
)
console
.
log
(
'
readUserO:
'
,
readUserO
);
// expect(readUserO.result.data.length).toBeGreaterThan(0)
})
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
()
const
updateUser
=
await
page
.
waitFor
(
async
()
=>
{
const
updateUserIndex
=
await
page
.
data
(
'
typeIndex
'
)
const
updateUserRole
=
await
page
.
data
(
'
currentRole
'
)
...
...
@@ -645,9 +590,8 @@ describe('pages/clientDB/permission-table-simple/permission-table-simple.vue', (
"
type
"
:
"
update
"
,
"
index
"
:
2
})
// console.log('updateUserC: ',updateUserC);
expect
(
updateUserC
.
result
.
updated
).
toBe
(
1
)
console
.
log
(
'
updateUserC:
'
,
updateUserC
);
// expect(updateUserC.result.updated).toBe(1)
// 仅更新自己创建的数据 先创建数据
const
updateUserD
=
await
page
.
callMethod
(
'
myFn
'
,
{
...
...
@@ -714,20 +658,12 @@ describe('pages/clientDB/permission-table-simple/permission-table-simple.vue', (
"
index
"
:
6
,
"
action
"
:
"
add_view_count
"
})
//
console.log('updateUserAction: ',updateUserAction);
expect
(
updateUserAction
.
result
.
updated
).
toBe
(
1
)
console
.
log
(
'
updateUserAction:
'
,
updateUserAction
);
//
expect(updateUserAction.result.updated).toBe(1)
// expect(updateUserAction.errCode).toBe(0)
})
it
(
'
删除--用户
'
,
async
()
=>
{
// const perPage = await page.$('.page')
//头部操作控制条
// const segItems = await perPage.$$('.segmented-control__item')
//底部角色控制条
// const roles = await perPage.$$('.roles-item')
//点击更新
await
segItems
[
3
].
tap
()
await
roles
[
1
].
tap
()
...
...
@@ -806,16 +742,7 @@ describe('pages/clientDB/permission-table-simple/permission-table-simple.vue', (
})
it
(
'
创建--审核员Auditor
'
,
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
()
...
...
@@ -825,8 +752,6 @@ describe('pages/clientDB/permission-table-simple/permission-table-simple.vue', (
return
createAuditorIndex
===
0
&&
createAuditorRole
==
'
auditor
'
})
//console.log(createAuditor, '创建--审核员');
await
page
.
callMethod
(
'
myFn
'
,
{
"
type
"
:
"
create
"
,
"
index
"
:
0
...
...
@@ -848,7 +773,6 @@ describe('pages/clientDB/permission-table-simple/permission-table-simple.vue', (
"
index
"
:
5
})
const
createAuditorB
=
await
page
.
callMethod
(
'
myFn
'
,
{
"
type
"
:
"
create
"
,
"
index
"
:
6
...
...
@@ -865,13 +789,6 @@ describe('pages/clientDB/permission-table-simple/permission-table-simple.vue', (
})
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
()
...
...
@@ -882,7 +799,6 @@ describe('pages/clientDB/permission-table-simple/permission-table-simple.vue', (
})
console
.
log
(
readAuditor
,
'
读取--审核员
'
);
await
page
.
callMethod
(
'
myFn
'
,
{
"
type
"
:
"
read
"
,
"
index
"
:
0
...
...
@@ -950,21 +866,9 @@ describe('pages/clientDB/permission-table-simple/permission-table-simple.vue', (
"
index
"
:
6
,
"
action
"
:
"
add_view_count
"
})
})
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
()
...
...
@@ -975,7 +879,6 @@ describe('pages/clientDB/permission-table-simple/permission-table-simple.vue', (
})
console
.
log
(
updateAuditor
,
'
更新--审核员
'
);
await
page
.
callMethod
(
'
myFn
'
,
{
"
type
"
:
"
update
"
,
"
index
"
:
0
...
...
@@ -1041,20 +944,9 @@ describe('pages/clientDB/permission-table-simple/permission-table-simple.vue', (
"
index
"
:
6
,
"
action
"
:
"
add_view_count
"
})
})
it
(
'
删除--审核员
'
,
async
()
=>
{
// const perPage = await page.$('.page')
//头部操作控制条
// const segItems = await perPage.$$('.segmented-control__item')
//底部角色控制条
// const roles = await perPage.$$('.roles-item')
//点击更新
await
segItems
[
3
].
tap
()
await
roles
[
2
].
tap
()
...
...
@@ -1065,7 +957,6 @@ describe('pages/clientDB/permission-table-simple/permission-table-simple.vue', (
})
//console.log(deleteAuditor, '删除--审核员');
await
page
.
callMethod
(
'
myFn
'
,
{
"
type
"
:
"
delete
"
,
"
index
"
:
0
...
...
@@ -1109,20 +1000,16 @@ describe('pages/clientDB/permission-table-simple/permission-table-simple.vue', (
"
where
"
:
"
create_time > 1613547725091
"
})
await
page
.
callMethod
(
'
myFn
'
,
{
"
type
"
:
"
delete
"
,
"
index
"
:
4
})
await
page
.
callMethod
(
'
myFn
'
,
{
"
type
"
:
"
delete
"
,
"
index
"
:
5
})
const
deleteAuditorB
=
await
page
.
callMethod
(
'
myFn
'
,
{
"
type
"
:
"
delete
"
,
"
index
"
:
6
...
...
@@ -1138,17 +1025,9 @@ describe('pages/clientDB/permission-table-simple/permission-table-simple.vue', (
})
it
(
'
创建--管理员admin
'
,
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
()
const
createAdmin
=
await
page
.
waitFor
(
async
()
=>
{
const
createAdminIndex
=
await
page
.
data
(
'
typeIndex
'
)
const
createAdminRole
=
await
page
.
data
(
'
currentRole
'
)
...
...
@@ -1156,7 +1035,6 @@ describe('pages/clientDB/permission-table-simple/permission-table-simple.vue', (
})
console
.
log
(
createAdmin
,
'
创建--管理员
'
);
await
page
.
callMethod
(
'
myFn
'
,
{
"
type
"
:
"
create
"
,
"
index
"
:
0
...
...
@@ -1178,43 +1056,28 @@ describe('pages/clientDB/permission-table-simple/permission-table-simple.vue', (
"
index
"
:
5
})
await
page
.
callMethod
(
'
myFn
'
,
{
"
type
"
:
"
create
"
,
"
index
"
:
6
})
await
page
.
callMethod
(
'
myFn
'
,
{
"
type
"
:
"
create
"
,
"
index
"
:
6
,
"
action
"
:
"
add_view_count
"
})
})
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
()
const
readAdmin
=
await
page
.
waitFor
(
async
()
=>
{
const
readAdminIndex
=
await
page
.
data
(
'
typeIndex
'
)
const
readAdminRole
=
await
page
.
data
(
'
currentRole
'
)
return
readAdminIndex
===
1
&&
readAdminRole
==
'
admin
'
})
//console.log(readAdmin, '读取--管理员');
await
page
.
callMethod
(
'
myFn
'
,
{
"
type
"
:
"
read
"
,
"
index
"
:
0
...
...
@@ -1257,14 +1120,11 @@ describe('pages/clientDB/permission-table-simple/permission-table-simple.vue', (
"
where
"
:
"
create_time > 1613541303576
"
})
await
page
.
callMethod
(
'
myFn
'
,
{
"
type
"
:
"
read
"
,
"
index
"
:
4
})
await
page
.
callMethod
(
'
myFn
'
,
{
"
type
"
:
"
read
"
,
"
index
"
:
5
...
...
@@ -1280,21 +1140,9 @@ describe('pages/clientDB/permission-table-simple/permission-table-simple.vue', (
"
index
"
:
6
,
"
action
"
:
"
add_view_count
"
})
})
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
()
...
...
@@ -1305,7 +1153,6 @@ describe('pages/clientDB/permission-table-simple/permission-table-simple.vue', (
})
//console.log(updateAdmin, '更新--管理员');
await
page
.
callMethod
(
'
myFn
'
,
{
"
type
"
:
"
update
"
,
"
index
"
:
0
...
...
@@ -1369,21 +1216,9 @@ describe('pages/clientDB/permission-table-simple/permission-table-simple.vue', (
"
index
"
:
6
,
"
action
"
:
"
add_view_count
"
})
})
it
(
'
删除--管理员
'
,
async
()
=>
{
// const perPage = await page.$('.page')
//头部操作控制条
// const segItems = await perPage.$$('.segmented-control__item')
//底部角色控制条
// const roles = await perPage.$$('.roles-item')
//点击更新
await
segItems
[
3
].
tap
()
await
roles
[
3
].
tap
()
...
...
@@ -1393,9 +1228,6 @@ describe('pages/clientDB/permission-table-simple/permission-table-simple.vue', (
return
deleteAdminIndex
===
3
&&
deleteAdminRole
===
'
admin
'
})
//console.log(deleteAdmin, '删除--管理员');
await
page
.
callMethod
(
'
myFn
'
,
{
"
type
"
:
"
delete
"
,
"
index
"
:
0
...
...
pages/clientDB/unicloud-db-demo/unicloud-db-demo.test.js
浏览文件 @
f39a22c1
...
...
@@ -74,10 +74,10 @@ describe('pages/clientDB/unicloud-db-demo/unicloud-db-demo', () => {
})
it
(
"
追加数据-add
"
,
async
()
=>
{
//改变分页策略为add
const
pageCheckbox
=
await
page
.
$
(
'
.page-checkbox
'
)
const
addSet
=
await
page
.
setData
({
"
pageData
"
:
"
add
"
})
// const pageCheckbox = await page.$('.page-checkbox')
await
page
.
setData
({
"
pageData
"
:
"
add
"
})
console
.
log
(
'
pageData---add:
'
,
await
page
.
data
(
'
pageData
'
));
const
isAdd
=
await
page
.
waitFor
(
async
()
=>
{
const
addText
=
await
page
.
data
(
'
pageData
'
)
return
addText
===
'
add
'
...
...
@@ -93,7 +93,7 @@ describe('pages/clientDB/unicloud-db-demo/unicloud-db-demo', () => {
if
(
process
.
env
.
UNI_PLATFORM
===
"
h5
"
||
process
.
env
.
UNI_PLATFORM
.
startsWith
(
"
app
"
))
{
const
loadMore
=
await
page
.
$
(
'
.loadMore
'
)
console
.
log
(
'
loadMore:
'
,
loadMore
);
//
await page.waitFor(300)
await
page
.
waitFor
(
300
)
await
loadMore
.
tap
()
await
page
.
waitFor
(
300
)
}
...
...
@@ -110,14 +110,11 @@ describe('pages/clientDB/unicloud-db-demo/unicloud-db-demo', () => {
expect
(
pageSizeSubAfter
).
toBeLessThanOrEqual
(
pageSizeSubBefore
);
//小于
})
it
(
"
设置排序字段-orderBy
"
,
async
()
=>
{
await
page
.
setData
({
"
orderby
"
:
'
create_date asc
'
})
})
it
(
"
是否查询总数据条数
"
,
async
()
=>
{
const
swGetcount
=
await
page
.
$
(
'
.switch-getcount
'
)
await
swGetcount
.
tap
()
...
...
@@ -125,7 +122,6 @@ describe('pages/clientDB/unicloud-db-demo/unicloud-db-demo', () => {
const
getcountBool
=
await
page
.
data
(
'
getcount
'
)
expect
.
assertions
(
1
);
expect
(
getcountBool
).
toBeFalsy
();
})
it
(
"
指定要查询的字段
"
,
async
()
=>
{
...
...
pages/clientDB/validate/validate.test.js
浏览文件 @
f39a22c1
...
...
@@ -5,7 +5,6 @@ describe('pages/clientDB/validate/validate.vue', () => {
// 重新reLaunch至首页,并获取首页page对象(其中 program 是uni-automator自动注入的全局对象)
page
=
await
program
.
reLaunch
(
'
/pages/clientDB/validate/validate
'
)
await
page
.
waitFor
(
'
view
'
)
page
=
await
program
.
currentPage
()
})
it
(
'
点击切换navBar
'
,
async
()
=>
{
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录