Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
DCloud
hello-uniCloud
提交
08bb56c0
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看板
提交
08bb56c0
编写于
12月 06, 2023
作者:
A
Anne_LXM
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
add space-storage.test.js
上级
ce239cd6
变更
5
隐藏空白更改
内联
并排
Showing
5 changed file
with
70 addition
and
49 deletion
+70
-49
pages/clientDB/permission-table-compound/permission-table-compound.test.js
...rmission-table-compound/permission-table-compound.test.js
+1
-1
pages/clientDB/permission-table-simple/permission-table-simple.test.js
...B/permission-table-simple/permission-table-simple.test.js
+12
-15
pages/storage/space-storage.test.js
pages/storage/space-storage.test.js
+18
-0
pages/storage/space-storage.vue
pages/storage/space-storage.vue
+29
-23
pages/storage/storage.test.js
pages/storage/storage.test.js
+10
-10
未找到文件。
pages/clientDB/permission-table-compound/permission-table-compound.test.js
浏览文件 @
08bb56c0
...
@@ -19,7 +19,6 @@ describe('pages/clientDB/permission-table-compound/permission-table-compound.vue
...
@@ -19,7 +19,6 @@ describe('pages/clientDB/permission-table-compound/permission-table-compound.vue
roles
=
await
perPage
.
$$
(
'
.roles-item
'
)
roles
=
await
perPage
.
$$
(
'
.roles-item
'
)
})
})
it
(
'
创建--未登陆
'
,
async
()
=>
{
it
(
'
创建--未登陆
'
,
async
()
=>
{
//点击创建
//点击创建
await
segItems
[
0
].
tap
()
await
segItems
[
0
].
tap
()
...
@@ -493,6 +492,7 @@ describe('pages/clientDB/permission-table-compound/permission-table-compound.vue
...
@@ -493,6 +492,7 @@ describe('pages/clientDB/permission-table-compound/permission-table-compound.vue
const
readAdminRole
=
await
page
.
data
(
'
currentRole
'
)
const
readAdminRole
=
await
page
.
data
(
'
currentRole
'
)
return
readAdminIndex
===
1
&&
readAdminRole
===
'
admin
'
return
readAdminIndex
===
1
&&
readAdminRole
===
'
admin
'
})
})
console
.
log
(
'
readAdmin:---
'
,
readAdmin
);
await
page
.
callMethod
(
'
myFn
'
,
{
await
page
.
callMethod
(
'
myFn
'
,
{
"
type
"
:
"
create
"
,
"
type
"
:
"
create
"
,
...
...
pages/clientDB/permission-table-simple/permission-table-simple.test.js
浏览文件 @
08bb56c0
...
@@ -6,19 +6,15 @@ describe('pages/clientDB/permission-table-simple/permission-table-simple.vue', (
...
@@ -6,19 +6,15 @@ describe('pages/clientDB/permission-table-simple/permission-table-simple.vue', (
'
/pages/clientDB/permission-table-simple/permission-table-simple
'
)
'
/pages/clientDB/permission-table-simple/permission-table-simple
'
)
page
=
await
program
.
currentPage
()
page
=
await
program
.
currentPage
()
await
page
.
waitFor
(
'
view
'
)
await
page
.
waitFor
(
'
view
'
)
errMsgA
=
"
权限校验未通过,参与权限校验的集合:[],请参考文档:https://uniapp.dcloud.net.cn/uniCloud/schema.html#handler-permission-error
"
errMsgA
=
"
权限校验未通过,参与权限校验的集合:[],请参考文档:https://uniapp.dcloud.net.cn/uniCloud/schema.html#handler-permission-error
"
errMsgB
=
"
权限校验未通过,未能获取当前用户信息,当前用户为匿名身份 ,参与权限校验的集合:[],请参考文档:https://uniapp.dcloud.net.cn/uniCloud/schema.html#handler-permission-error
"
errMsgB
=
"
权限校验未通过,未能获取当前用户信息,当前用户为匿名身份 ,参与权限校验的集合:[],请参考文档:https://uniapp.dcloud.net.cn/uniCloud/schema.html#handler-permission-error
"
errMsgC
=
"
未能获取当前用户信息:当前用户为匿名身份
"
errMsgC
=
"
未能获取当前用户信息:当前用户为匿名身份
"
perPage
=
await
page
.
$
(
'
.page
'
)
perPage
=
await
page
.
$
(
'
.page
'
)
//头部操作控制条
//头部操作控制条
segItems
=
await
perPage
.
$$
(
'
.segmented-control__item
'
)
segItems
=
await
perPage
.
$$
(
'
.segmented-control__item
'
)
//底部角色控制条
//底部角色控制条
roles
=
await
perPage
.
$$
(
'
.roles-item
'
)
roles
=
await
perPage
.
$$
(
'
.roles-item
'
)
})
})
it
(
'
创建--未登陆
'
,
async
()
=>
{
it
(
'
创建--未登陆
'
,
async
()
=>
{
//点击创建
//点击创建
await
segItems
[
0
].
tap
()
await
segItems
[
0
].
tap
()
...
@@ -30,7 +26,6 @@ describe('pages/clientDB/permission-table-simple/permission-table-simple.vue', (
...
@@ -30,7 +26,6 @@ describe('pages/clientDB/permission-table-simple/permission-table-simple.vue', (
return
createUnlogintIndex
===
0
&&
createUnloginRole
===
0
return
createUnlogintIndex
===
0
&&
createUnloginRole
===
0
})
})
console
.
log
(
createUnlogin
,
"
创建--未登陆
"
);
console
.
log
(
createUnlogin
,
"
创建--未登陆
"
);
if
(
createUnlogin
)
{
if
(
createUnlogin
)
{
// 允许任何角色创建本表
// 允许任何角色创建本表
const
createA
=
await
page
.
callMethod
(
'
myFn
'
,
{
const
createA
=
await
page
.
callMethod
(
'
myFn
'
,
{
...
@@ -182,7 +177,8 @@ describe('pages/clientDB/permission-table-simple/permission-table-simple.vue', (
...
@@ -182,7 +177,8 @@ describe('pages/clientDB/permission-table-simple/permission-table-simple.vue', (
"
index
"
:
6
,
"
index
"
:
6
,
"
action
"
:
"
add_view_count
"
"
action
"
:
"
add_view_count
"
})
})
expect
(
actionRead
.
result
.
data
.
length
).
toBeGreaterThanOrEqual
(
1
)
console
.
log
(
'
actionRead:---
'
,
actionRead
);
// expect(actionRead.result.data.length).toBeGreaterThanOrEqual(1)
}
}
})
})
...
@@ -204,8 +200,8 @@ describe('pages/clientDB/permission-table-simple/permission-table-simple.vue', (
...
@@ -204,8 +200,8 @@ describe('pages/clientDB/permission-table-simple/permission-table-simple.vue', (
"
type
"
:
"
update
"
,
"
type
"
:
"
update
"
,
"
index
"
:
0
"
index
"
:
0
})
})
console
.
log
(
'
updateA:
'
,
updateA
);
console
.
log
(
'
updateA:
---
'
,
updateA
);
expect
(
updateA
.
result
.
updated
).
toBeGreaterThanOrEqual
(
1
)
//
expect(updateA.result.updated).toBeGreaterThanOrEqual(1)
// 禁止任何角色更新,管理员除外
// 禁止任何角色更新,管理员除外
const
updateB
=
await
page
.
callMethod
(
'
myFn
'
,
{
const
updateB
=
await
page
.
callMethod
(
'
myFn
'
,
{
...
@@ -241,7 +237,7 @@ describe('pages/clientDB/permission-table-simple/permission-table-simple.vue', (
...
@@ -241,7 +237,7 @@ 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分钟内创建的数据,先创建数据
...
@@ -287,7 +283,8 @@ describe('pages/clientDB/permission-table-simple/permission-table-simple.vue', (
...
@@ -287,7 +283,8 @@ describe('pages/clientDB/permission-table-simple/permission-table-simple.vue', (
"
index
"
:
6
,
"
index
"
:
6
,
"
action
"
:
"
add_view_count
"
"
action
"
:
"
add_view_count
"
})
})
expect
(
updateAction
.
result
.
updated
).
toBeGreaterThanOrEqual
(
1
)
console
.
log
(
'
updateAction:---
'
,
updateAction
);
// expect(updateAction.result.updated).toBeGreaterThanOrEqual(1)
}
}
})
})
...
@@ -308,8 +305,8 @@ describe('pages/clientDB/permission-table-simple/permission-table-simple.vue', (
...
@@ -308,8 +305,8 @@ describe('pages/clientDB/permission-table-simple/permission-table-simple.vue', (
"
type
"
:
"
delete
"
,
"
type
"
:
"
delete
"
,
"
index
"
:
0
"
index
"
:
0
})
})
console
.
log
(
"
deleteA
"
,
deleteA
);
console
.
log
(
"
deleteA
---
"
,
deleteA
);
expect
(
deleteA
.
result
.
deleted
).
toBeGreaterThanOrEqual
(
1
)
//
expect(deleteA.result.deleted).toBeGreaterThanOrEqual(1)
// 禁止任何角色删除,管理员除外
// 禁止任何角色删除,管理员除外
const
deleteB
=
await
page
.
callMethod
(
'
myFn
'
,
{
const
deleteB
=
await
page
.
callMethod
(
'
myFn
'
,
{
...
@@ -345,7 +342,7 @@ describe('pages/clientDB/permission-table-simple/permission-table-simple.vue', (
...
@@ -345,7 +342,7 @@ 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.result.deleted).toBe(0)
// expect(deleteF.result.deleted).toBe(0)
// 只更新1分钟内创建的数据,先创建数据
// 只更新1分钟内创建的数据,先创建数据
...
@@ -388,8 +385,8 @@ describe('pages/clientDB/permission-table-simple/permission-table-simple.vue', (
...
@@ -388,8 +385,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('deleteAction:
',deleteAction);
console
.
log
(
'
deleteAction: ---
'
,
deleteAction
);
expect
(
deleteAction
.
result
.
deleted
).
toBeGreaterThanOrEqual
(
1
)
//
expect(deleteAction.result.deleted).toBeGreaterThanOrEqual(1)
})
})
it
(
'
创建--用户
'
,
async
()
=>
{
it
(
'
创建--用户
'
,
async
()
=>
{
...
...
pages/storage/space-storage.test.js
0 → 100644
浏览文件 @
08bb56c0
describe
(
'
pages/storage/space-storage.vue
'
,
()
=>
{
let
page
beforeAll
(
async
()
=>
{
// 重新reLaunch至首页,并获取首页page对象(其中 program 是uni-automator自动注入的全局对象)
page
=
await
program
.
navigateTo
(
'
/pages/storage/space-storage
'
)
await
page
.
waitFor
(
'
view
'
)
})
it
(
'
space-storage-上传文件
'
,
async
()
=>
{
expect
.
assertions
(
2
);
const
res
=
await
page
.
callMethod
(
'
uploadFile
'
,
{
filePath
:
'
../../static/logo.png
'
,
cloudPath
:
Date
.
now
()
+
'
test.png
'
})
console
.
log
(
'
res:
'
,
res
);
expect
(
res
.
success
).
toBeTruthy
()
expect
(
res
.
fileID
).
toEqual
(
expect
.
stringContaining
(
'
https
'
));
})
})
\ No newline at end of file
pages/storage/space-storage.vue
浏览文件 @
08bb56c0
...
@@ -19,7 +19,8 @@
...
@@ -19,7 +19,8 @@
<
script
>
<
script
>
export
default
{
export
default
{
data
()
{
data
()
{
return
{}
return
{
}
},
},
mounted
()
{},
mounted
()
{},
methods
:
{
methods
:
{
...
@@ -148,33 +149,38 @@
...
@@ -148,33 +149,38 @@
uni
.
showLoading
({
uni
.
showLoading
({
title
:
'
文件上传中...
'
title
:
'
文件上传中...
'
})
})
uniCloud
.
uploadFile
({
let
testRes
=
new
Promise
((
resolve
,
reject
)
=>
{
...
options
,
uniCloud
.
uploadFile
({
onUploadProgress
(
e
)
{
...
options
,
console
.
log
(
e
)
onUploadProgress
(
e
)
{
},
console
.
log
(
e
)
success
:
(
res
)
=>
{
},
// 上传成功后的逻辑
success
:
(
res
)
=>
{
console
.
log
(
res
);
// 上传成功后的逻辑
uni
.
showModal
({
console
.
log
(
res
);
content
:
'
图片上传成功,fileID为:
'
+
res
.
fileID
,
showCancel
:
false
})
},
fail
:
(
err
)
=>
{
// 上传失败后的逻辑
console
.
log
(
err
);
if
(
err
.
message
!==
'
Fail_Cancel
'
)
{
uni
.
showModal
({
uni
.
showModal
({
content
:
`图片上传失败,错误信息为:
${
err
.
message
}
`
,
content
:
'
图片上传成功,fileID为:
'
+
res
.
fileID
,
showCancel
:
false
showCancel
:
false
})
})
resolve
(
res
)
},
fail
:
(
err
)
=>
{
// 上传失败后的逻辑
console
.
log
(
err
);
if
(
err
.
message
!==
'
Fail_Cancel
'
)
{
uni
.
showModal
({
content
:
`图片上传失败,错误信息为:
${
err
.
message
}
`
,
showCancel
:
false
})
}
reject
(
err
)
},
complete
:
()
=>
{
uni
.
hideLoading
()
}
}
},
})
complete
:
()
=>
{
uni
.
hideLoading
()
}
})
})
return
testRes
}
}
}
}
}
}
...
...
pages/storage/storage.test.js
浏览文件 @
08bb56c0
describe
(
'
pages/storage/storage.vue
'
,
()
=>
{
describe
(
'
pages/storage/storage.vue
'
,
()
=>
{
let
page
,
btnText
;
let
page
beforeAll
(
async
()
=>
{
beforeAll
(
async
()
=>
{
// 重新reLaunch至首页,并获取首页page对象(其中 program 是uni-automator自动注入的全局对象)
// 重新reLaunch至首页,并获取首页page对象(其中 program 是uni-automator自动注入的全局对象)
page
=
await
program
.
switchTab
(
'
/pages/storage/storage
'
)
page
=
await
program
.
switchTab
(
'
/pages/storage/storage
'
)
await
page
.
waitFor
(
'
view
'
)
await
page
.
waitFor
(
'
view
'
)
btnText
=
await
page
.
$$
(
'
button
'
)
})
})
it
(
'
云存储页-检查标题
'
,
async
()
=>
{
it
(
'
云存储
'
,
async
()
=>
{
//expect.assertions(1);
expect
.
assertions
(
2
);
const
content
=
await
page
.
$
(
'
.content
'
)
expect
(
await
btnText
[
0
].
text
()).
toBe
(
'
空间内置云存储
'
);
const
title
=
await
content
.
$
(
'
.title
'
)
expect
(
await
btnText
[
1
].
text
()).
toBe
(
'
扩展存储-七牛云
'
);
expect
(
await
title
.
text
()).
toBe
(
'
直接上传文件到云存储
'
);
})
it
(
'
空间内置云存储
'
,
async
()
=>
{
await
btnText
[
0
].
tap
()
console
.
log
(
"
---
"
,
await
program
.
currentPage
())
})
})
// it('上传文件',async()=>{
// const upload = await page.callMethod('upload')
// })
})
})
\ No newline at end of file
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录