Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
DCloud
hello-uvue
提交
599c6e1b
H
hello-uvue
项目概览
DCloud
/
hello-uvue
通知
350
Star
2
Fork
7
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
1
列表
看板
标记
里程碑
合并请求
0
DevOps
流水线
流水线任务
计划
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
H
hello-uvue
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
1
Issue
1
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
DevOps
DevOps
流水线
流水线任务
计划
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
流水线任务
提交
Issue看板
提交
599c6e1b
编写于
1月 24, 2024
作者:
雪洛
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
feat: 调整测试例兼容web端
上级
0788cc70
变更
8
隐藏空白更改
内联
并排
Showing
8 changed file
with
32 addition
and
8 deletion
+32
-8
pages/composition-api/lifecycle/page-lifecycle/page-lifecycle.test.js
...ition-api/lifecycle/page-lifecycle/page-lifecycle.test.js
+8
-1
pages/composition-api/reactivity/on-scope-dispose/on-scope-dispose.uvue
...ion-api/reactivity/on-scope-dispose/on-scope-dispose.uvue
+2
-2
pages/composition-api/reactivity/readonly/readonly.test.js
pages/composition-api/reactivity/readonly/readonly.test.js
+1
-1
pages/composition-api/reactivity/shallow-readonly/shallow-readonly.test.js
...-api/reactivity/shallow-readonly/shallow-readonly.test.js
+5
-0
pages/composition-api/reactivity/to-refs/to-refs.test.js
pages/composition-api/reactivity/to-refs/to-refs.test.js
+7
-0
pages/composition-api/reactivity/watch-post-effect/watch-post-effect.test.js
...pi/reactivity/watch-post-effect/watch-post-effect.test.js
+4
-1
pages/composition-api/reactivity/watch-sync-effect/watch-sync-effect.test.js
...pi/reactivity/watch-sync-effect/watch-sync-effect.test.js
+1
-1
pages/composition/setup/setup.test.js
pages/composition/setup/setup.test.js
+4
-2
未找到文件。
pages/composition-api/lifecycle/page-lifecycle/page-lifecycle.test.js
浏览文件 @
599c6e1b
...
@@ -4,7 +4,14 @@ const INTER_PAGE_PATH = '/pages/app-instance/index/index'
...
@@ -4,7 +4,14 @@ const INTER_PAGE_PATH = '/pages/app-instance/index/index'
let
page
let
page
let
lifeCycleNum
let
lifeCycleNum
describe
(
'
page-lifecycle
'
,
()
=>
{
describe
(
'
page-lifecycle
'
,
()
=>
{
if
(
process
.
env
.
uniTestPlatformInfo
.
startsWith
(
'
web
'
))
{
// TODO: 自动化测试暂不能调用web端setup内defineExpose导出的方法,待自动化测试兼容后开放此测试例
it
(
'
web
'
,
async
()
=>
{
expect
(
1
).
toBe
(
1
)
})
return
}
beforeAll
(
async
()
=>
{
beforeAll
(
async
()
=>
{
page
=
await
program
.
reLaunch
(
HOME_PATH
)
page
=
await
program
.
reLaunch
(
HOME_PATH
)
await
page
.
waitFor
(
700
)
await
page
.
waitFor
(
700
)
...
...
pages/composition-api/reactivity/on-scope-dispose/on-scope-dispose.uvue
浏览文件 @
599c6e1b
...
@@ -14,9 +14,9 @@
...
@@ -14,9 +14,9 @@
const createScope = () => {
const createScope = () => {
scope = effectScope();
scope = effectScope();
(scope as EffectScope).run(() => {
(scope as EffectScope).run(() => {
hasCurrentScope.value = getCurrentScope() !=
=
null
hasCurrentScope.value = getCurrentScope() != null
onScopeDispose(() => {
onScopeDispose(() => {
hasCurrentScope.value = getCurrentScope() !=
=
null
hasCurrentScope.value = getCurrentScope() != null
})
})
})
})
}
}
...
...
pages/composition-api/reactivity/readonly/readonly.test.js
浏览文件 @
599c6e1b
...
@@ -37,7 +37,7 @@ describe('ref', () => {
...
@@ -37,7 +37,7 @@ describe('ref', () => {
expect
(
await
dataStr
.
text
()).
toBe
(
'
data.str: new str
'
)
expect
(
await
dataStr
.
text
()).
toBe
(
'
data.str: new str
'
)
expect
(
await
dataNum
.
text
()).
toBe
(
'
data.num: 1
'
)
expect
(
await
dataNum
.
text
()).
toBe
(
'
data.num: 1
'
)
expect
(
await
dataArr
.
text
()).
toBe
(
isWeb
?
'
data.arr: [
\n
"a",
\n
"b",
\n
"c",
\n
"d"]
'
:
'
data.arr: ["a","b","c","d"]
'
)
expect
(
await
dataArr
.
text
()).
toBe
(
isWeb
?
'
data.arr: [
\n
"a",
\n
"b",
\n
"c",
\n
"d"
\n
]
'
:
'
data.arr: ["a","b","c","d"]
'
)
expect
(
await
readonlyDataStr
.
text
()).
toBe
(
'
readonly data.str: new str
'
)
expect
(
await
readonlyDataStr
.
text
()).
toBe
(
'
readonly data.str: new str
'
)
expect
(
await
readonlyDataNum
.
text
()).
toBe
(
'
readonly data.num: 1
'
)
expect
(
await
readonlyDataNum
.
text
()).
toBe
(
'
readonly data.num: 1
'
)
expect
(
await
readonlyDataArr
.
text
()).
toBe
(
isWeb
?
'
readonly data.arr: [
\n
"a",
\n
"b",
\n
"c",
\n
"d"
\n
]
'
:
'
readonly data.arr: ["a","b","c","d"]
'
)
expect
(
await
readonlyDataArr
.
text
()).
toBe
(
isWeb
?
'
readonly data.arr: [
\n
"a",
\n
"b",
\n
"c",
\n
"d"
\n
]
'
:
'
readonly data.arr: ["a","b","c","d"]
'
)
...
...
pages/composition-api/reactivity/shallow-readonly/shallow-readonly.test.js
浏览文件 @
599c6e1b
...
@@ -13,6 +13,11 @@ describe('shallowReadonly', () => {
...
@@ -13,6 +13,11 @@ describe('shallowReadonly', () => {
let
stateNestedCount
=
await
page
.
$
(
'
#state-nested-count
'
)
let
stateNestedCount
=
await
page
.
$
(
'
#state-nested-count
'
)
expect
(
await
stateNestedCount
.
text
()).
toBe
(
'
state.nested.count: 0
'
)
expect
(
await
stateNestedCount
.
text
()).
toBe
(
'
state.nested.count: 0
'
)
if
(
process
.
env
.
uniTestPlatformInfo
.
startsWith
(
'
web
'
))
{
// web端操作readonly对象会直接编译失败,以下测试无法执行
return
}
const
incrementStateCountBtn
=
await
page
.
$
(
'
#increment-state-count-btn
'
)
const
incrementStateCountBtn
=
await
page
.
$
(
'
#increment-state-count-btn
'
)
await
incrementStateCountBtn
.
tap
()
await
incrementStateCountBtn
.
tap
()
...
...
pages/composition-api/reactivity/to-refs/to-refs.test.js
浏览文件 @
599c6e1b
const
PAGE_PATH
=
'
/pages/composition-api/reactivity/to-refs/to-refs
'
const
PAGE_PATH
=
'
/pages/composition-api/reactivity/to-refs/to-refs
'
describe
(
'
toRefs
'
,
()
=>
{
describe
(
'
toRefs
'
,
()
=>
{
if
(
process
.
env
.
uniTestPlatformInfo
.
startsWith
(
'
web
'
))
{
// TODO: web 端暂不支持
it
(
'
web
'
,
async
()
=>
{
expect
(
1
).
toBe
(
1
)
})
return
}
let
page
=
null
let
page
=
null
beforeAll
(
async
()
=>
{
beforeAll
(
async
()
=>
{
page
=
await
program
.
reLaunch
(
PAGE_PATH
)
page
=
await
program
.
reLaunch
(
PAGE_PATH
)
...
...
pages/composition-api/reactivity/watch-post-effect/watch-post-effect.test.js
浏览文件 @
599c6e1b
...
@@ -102,7 +102,10 @@ describe('watchPostEffect', () => {
...
@@ -102,7 +102,10 @@ describe('watchPostEffect', () => {
expect
(
await
objArr
.
text
()).
toBe
(
isWeb
?
'
obj.arr: [
\n
0,
\n
1
\n
]
'
:
'
obj.arr: [0,1]
'
)
expect
(
await
objArr
.
text
()).
toBe
(
isWeb
?
'
obj.arr: [
\n
0,
\n
1
\n
]
'
:
'
obj.arr: [0,1]
'
)
expect
(
await
watchObjRes
.
text
()).
toBe
(
expect
(
await
watchObjRes
.
text
()).
toBe
(
'
watch obj result: obj: {"arr":[0],"bool":false,"num":0,"str":"num: 0"}
'
)
isWeb
?
'
watch obj result: obj: {"num":0,"str":"num: 0","bool":false,"arr":[0]}
'
:
'
watch obj result: obj: {"arr":[0],"bool":false,"num":0,"str":"num: 0"}
'
)
expect
(
await
watchObjStrRes
.
text
()).
toBe
(
expect
(
await
watchObjStrRes
.
text
()).
toBe
(
'
watch obj.str result: str: num: 1, obj.str ref text: obj.str: num: 1
'
)
'
watch obj.str result: str: num: 1, obj.str ref text: obj.str: num: 1
'
)
expect
(
await
watchObjArrRes
.
text
()).
toBe
(
isWeb
?
'
watch obj.arr result: arr: [
\n
0,
\n
1
\n
]
'
:
expect
(
await
watchObjArrRes
.
text
()).
toBe
(
isWeb
?
'
watch obj.arr result: arr: [
\n
0,
\n
1
\n
]
'
:
...
...
pages/composition-api/reactivity/watch-sync-effect/watch-sync-effect.test.js
浏览文件 @
599c6e1b
...
@@ -96,7 +96,7 @@ describe('watchSyncEffect', () => {
...
@@ -96,7 +96,7 @@ describe('watchSyncEffect', () => {
expect
(
await
objStr
.
text
()).
toBe
(
'
obj.str: num: 1
'
)
expect
(
await
objStr
.
text
()).
toBe
(
'
obj.str: num: 1
'
)
expect
(
await
objNum
.
text
()).
toBe
(
'
obj.num: 1
'
)
expect
(
await
objNum
.
text
()).
toBe
(
'
obj.num: 1
'
)
expect
(
await
objBool
.
text
()).
toBe
(
'
obj.bool: true
'
)
expect
(
await
objBool
.
text
()).
toBe
(
'
obj.bool: true
'
)
expect
(
await
objArr
.
text
()).
toBe
(
'
obj.arr: [0,1]
'
)
expect
(
await
objArr
.
text
()).
toBe
(
isWeb
?
'
obj.arr: [
\n
0,
\n
1
\n
]
'
:
'
obj.arr: [0,1]
'
)
expect
(
await
watchObjRes
.
text
()).
toBe
(
expect
(
await
watchObjRes
.
text
()).
toBe
(
'
watch obj result: obj: {"arr":[0],"bool":false,"num":0,"str":"num: 0"}
'
)
'
watch obj result: obj: {"arr":[0],"bool":false,"num":0,"str":"num: 0"}
'
)
...
...
pages/composition/setup/setup.test.js
浏览文件 @
599c6e1b
...
@@ -44,8 +44,10 @@ describe('options setup', () => {
...
@@ -44,8 +44,10 @@ describe('options setup', () => {
const
count
=
await
page
.
$
(
'
#count
'
)
const
count
=
await
page
.
$
(
'
#count
'
)
expect
(
await
count
.
text
()).
toBe
(
'
count: 1
'
)
expect
(
await
count
.
text
()).
toBe
(
'
count: 1
'
)
const
propsCount
=
await
page
.
$
(
'
#props-count
'
)
if
(
!
process
.
env
.
uniTestPlatformInfo
.
startsWith
(
'
web
'
))
{
expect
(
await
propsCount
.
text
()).
toBe
(
'
props.count: 1
'
)
const
propsCount
=
await
page
.
$
(
'
#props-count
'
)
expect
(
await
propsCount
.
text
()).
toBe
(
'
props.count: 1
'
)
}
const
updateObjBtn
=
await
page
.
$
(
'
#update-obj-btn
'
)
const
updateObjBtn
=
await
page
.
$
(
'
#update-obj-btn
'
)
await
updateObjBtn
.
tap
()
await
updateObjBtn
.
tap
()
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录