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
roles
=
await
perPage
.
$$
(
'
.roles-item
'
)
})
it
(
'
创建--未登陆
'
,
async
()
=>
{
//点击创建
await
segItems
[
0
].
tap
()
...
...
@@ -493,6 +492,7 @@ describe('pages/clientDB/permission-table-compound/permission-table-compound.vue
const
readAdminRole
=
await
page
.
data
(
'
currentRole
'
)
return
readAdminIndex
===
1
&&
readAdminRole
===
'
admin
'
})
console
.
log
(
'
readAdmin:---
'
,
readAdmin
);
await
page
.
callMethod
(
'
myFn
'
,
{
"
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', (
'
/pages/clientDB/permission-table-simple/permission-table-simple
'
)
page
=
await
program
.
currentPage
()
await
page
.
waitFor
(
'
view
'
)
errMsgA
=
"
权限校验未通过,参与权限校验的集合:[],请参考文档:https://uniapp.dcloud.net.cn/uniCloud/schema.html#handler-permission-error
"
errMsgB
=
"
权限校验未通过,未能获取当前用户信息,当前用户为匿名身份 ,参与权限校验的集合:[],请参考文档:https://uniapp.dcloud.net.cn/uniCloud/schema.html#handler-permission-error
"
errMsgC
=
"
未能获取当前用户信息:当前用户为匿名身份
"
perPage
=
await
page
.
$
(
'
.page
'
)
//头部操作控制条
segItems
=
await
perPage
.
$$
(
'
.segmented-control__item
'
)
//底部角色控制条
roles
=
await
perPage
.
$$
(
'
.roles-item
'
)
})
it
(
'
创建--未登陆
'
,
async
()
=>
{
//点击创建
await
segItems
[
0
].
tap
()
...
...
@@ -30,7 +26,6 @@ describe('pages/clientDB/permission-table-simple/permission-table-simple.vue', (
return
createUnlogintIndex
===
0
&&
createUnloginRole
===
0
})
console
.
log
(
createUnlogin
,
"
创建--未登陆
"
);
if
(
createUnlogin
)
{
// 允许任何角色创建本表
const
createA
=
await
page
.
callMethod
(
'
myFn
'
,
{
...
...
@@ -182,7 +177,8 @@ describe('pages/clientDB/permission-table-simple/permission-table-simple.vue', (
"
index
"
:
6
,
"
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', (
"
type
"
:
"
update
"
,
"
index
"
:
0
})
console
.
log
(
'
updateA:
'
,
updateA
);
expect
(
updateA
.
result
.
updated
).
toBeGreaterThanOrEqual
(
1
)
console
.
log
(
'
updateA:
---
'
,
updateA
);
//
expect(updateA.result.updated).toBeGreaterThanOrEqual(1)
// 禁止任何角色更新,管理员除外
const
updateB
=
await
page
.
callMethod
(
'
myFn
'
,
{
...
...
@@ -241,7 +237,7 @@ describe('pages/clientDB/permission-table-simple/permission-table-simple.vue', (
"
type
"
:
"
update
"
,
"
index
"
:
3
})
console
.
log
(
'
updateF:---
-------
'
,
updateF
);
console
.
log
(
'
updateF:---
'
,
updateF
);
// expect(updateF.result.updated).toBe(0)
// 只更新1分钟内创建的数据,先创建数据
...
...
@@ -287,7 +283,8 @@ describe('pages/clientDB/permission-table-simple/permission-table-simple.vue', (
"
index
"
:
6
,
"
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', (
"
type
"
:
"
delete
"
,
"
index
"
:
0
})
console
.
log
(
"
deleteA
"
,
deleteA
);
expect
(
deleteA
.
result
.
deleted
).
toBeGreaterThanOrEqual
(
1
)
console
.
log
(
"
deleteA
---
"
,
deleteA
);
//
expect(deleteA.result.deleted).toBeGreaterThanOrEqual(1)
// 禁止任何角色删除,管理员除外
const
deleteB
=
await
page
.
callMethod
(
'
myFn
'
,
{
...
...
@@ -345,7 +342,7 @@ describe('pages/clientDB/permission-table-simple/permission-table-simple.vue', (
"
type
"
:
"
delete
"
,
"
index
"
:
3
})
console
.
log
(
'
deleteF: ---
----
'
,
deleteF
);
console
.
log
(
'
deleteF: ---
'
,
deleteF
);
// expect(deleteF.result.deleted).toBe(0)
// 只更新1分钟内创建的数据,先创建数据
...
...
@@ -388,8 +385,8 @@ describe('pages/clientDB/permission-table-simple/permission-table-simple.vue', (
"
index
"
:
6
,
"
action
"
:
"
add_view_count
"
})
// console.log('deleteAction:
',deleteAction);
expect
(
deleteAction
.
result
.
deleted
).
toBeGreaterThanOrEqual
(
1
)
console
.
log
(
'
deleteAction: ---
'
,
deleteAction
);
//
expect(deleteAction.result.deleted).toBeGreaterThanOrEqual(1)
})
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 @@
<
script
>
export
default
{
data
()
{
return
{}
return
{
}
},
mounted
()
{},
methods
:
{
...
...
@@ -148,33 +149,38 @@
uni
.
showLoading
({
title
:
'
文件上传中...
'
})
uniCloud
.
uploadFile
({
...
options
,
onUploadProgress
(
e
)
{
console
.
log
(
e
)
},
success
:
(
res
)
=>
{
// 上传成功后的逻辑
console
.
log
(
res
);
uni
.
showModal
({
content
:
'
图片上传成功,fileID为:
'
+
res
.
fileID
,
showCancel
:
false
})
},
fail
:
(
err
)
=>
{
// 上传失败后的逻辑
console
.
log
(
err
);
if
(
err
.
message
!==
'
Fail_Cancel
'
)
{
let
testRes
=
new
Promise
((
resolve
,
reject
)
=>
{
uniCloud
.
uploadFile
({
...
options
,
onUploadProgress
(
e
)
{
console
.
log
(
e
)
},
success
:
(
res
)
=>
{
// 上传成功后的逻辑
console
.
log
(
res
);
uni
.
showModal
({
content
:
`图片上传失败,错误信息为:
${
err
.
message
}
`
,
content
:
'
图片上传成功,fileID为:
'
+
res
.
fileID
,
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
'
,
()
=>
{
let
page
let
page
,
btnText
;
beforeAll
(
async
()
=>
{
// 重新reLaunch至首页,并获取首页page对象(其中 program 是uni-automator自动注入的全局对象)
page
=
await
program
.
switchTab
(
'
/pages/storage/storage
'
)
await
page
.
waitFor
(
'
view
'
)
btnText
=
await
page
.
$$
(
'
button
'
)
})
it
(
'
云存储页-检查标题
'
,
async
()
=>
{
//expect.assertions(1);
const
content
=
await
page
.
$
(
'
.content
'
)
const
title
=
await
content
.
$
(
'
.title
'
)
expect
(
await
title
.
text
()).
toBe
(
'
直接上传文件到云存储
'
);
it
(
'
云存储
'
,
async
()
=>
{
expect
.
assertions
(
2
);
expect
(
await
btnText
[
0
].
text
()).
toBe
(
'
空间内置云存储
'
);
expect
(
await
btnText
[
1
].
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.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录