Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
DCloud
hello-uvue
提交
a889ec1e
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看板
提交
a889ec1e
编写于
1月 24, 2024
作者:
DCloud-WZF
💬
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
test: 调整测试例兼容 web 端
上级
a9bbe02f
变更
18
显示空白变更内容
内联
并排
Showing
18 changed file
with
144 addition
and
164 deletion
+144
-164
pages/component-instance/force-update/force-update.test.js
pages/component-instance/force-update/force-update.test.js
+1
-1
pages/component-instance/props/props.test.js
pages/component-instance/props/props.test.js
+4
-4
pages/composition-api/basic/define-slots/define-slots.test.js
...s/composition-api/basic/define-slots/define-slots.test.js
+1
-1
pages/composition-api/dependency-injection/provide/provide-inject.test.js
...n-api/dependency-injection/provide/provide-inject.test.js
+2
-2
pages/composition-api/lifecycle/component-lifecycle/component-lifecycle.test.js
...lifecycle/component-lifecycle/component-lifecycle.test.js
+0
-7
pages/composition-api/lifecycle/page-lifecycle/page-lifecycle.test.js
...ition-api/lifecycle/page-lifecycle/page-lifecycle.test.js
+9
-9
pages/composition-api/reactivity/computed/computed.test.js
pages/composition-api/reactivity/computed/computed.test.js
+3
-3
pages/composition-api/reactivity/computed/computed.uvue
pages/composition-api/reactivity/computed/computed.uvue
+1
-1
pages/composition-api/reactivity/reactive/reactive.test.js
pages/composition-api/reactivity/reactive/reactive.test.js
+2
-2
pages/composition-api/reactivity/readonly/readonly.test.js
pages/composition-api/reactivity/readonly/readonly.test.js
+7
-8
pages/composition-api/reactivity/watch-effect/watch-effect.test.js
...position-api/reactivity/watch-effect/watch-effect.test.js
+2
-2
pages/composition-api/reactivity/watch-post-effect/watch-post-effect.test.js
...pi/reactivity/watch-post-effect/watch-post-effect.test.js
+4
-4
pages/composition-api/reactivity/watch-sync-effect/watch-sync-effect.test.js
...pi/reactivity/watch-sync-effect/watch-sync-effect.test.js
+2
-2
pages/composition-api/reactivity/watch/watch.test.js
pages/composition-api/reactivity/watch/watch.test.js
+2
-2
pages/composition/provide/provide-page2.test.js
pages/composition/provide/provide-page2.test.js
+3
-3
pages/composition/provide/provide.test.js
pages/composition/provide/provide.test.js
+4
-4
pages/directive/v-model/v-model.test.js
pages/directive/v-model/v-model.test.js
+22
-25
pages/lifecycle/page/page.test.js
pages/lifecycle/page/page.test.js
+75
-84
未找到文件。
pages/component-instance/force-update/force-update.test.js
浏览文件 @
a889ec1e
...
...
@@ -14,6 +14,6 @@ describe('$forceUpdate', () => {
await
triggerForceUpdateBtn
.
tap
()
const
timeText2
=
(
await
timeEl
.
text
()).
replace
(
'
Date.now():
'
,
''
)
expect
(
parseInt
(
timeText2
)).
toBeGreaterThan
(
parseInt
(
timeText1
))
expect
(
parseInt
(
timeText2
)).
toBeGreaterThan
OrEqual
(
parseInt
(
timeText1
))
})
})
pages/component-instance/props/props.test.js
浏览文件 @
a889ec1e
...
...
@@ -15,9 +15,9 @@ describe('$props', () => {
const
arrayLiteralBool
=
await
page
.
$
(
'
#array-literal-bool
'
)
expect
(
await
arrayLiteralBool
.
text
()).
toBe
(
'
true
'
)
const
arrayLiteralObj
=
await
page
.
$
(
'
#array-literal-obj
'
)
expect
((
await
arrayLiteralObj
.
text
()).
replaceAll
(
'
\n
'
,
''
).
replaceAll
(
'
'
,
''
)).
toBe
(
'
{"count":1}
'
)
expect
((
await
arrayLiteralObj
.
text
()).
replaceAll
(
'
'
,
''
)).
toBe
(
'
{"count":1}
'
)
const
arrayLiteralArr
=
await
page
.
$
(
'
#array-literal-arr
'
)
expect
(
(
await
arrayLiteralArr
.
text
()).
replaceAll
(
'
\n
'
,
''
)).
toBe
(
'
[1,2,3]
'
)
expect
(
await
arrayLiteralArr
.
text
(
)).
toBe
(
'
[1,2,3]
'
)
const
string
=
await
page
.
$
(
'
.string
'
)
const
number
=
await
page
.
$
(
'
.number
'
)
...
...
@@ -32,8 +32,8 @@ describe('$props', () => {
expect
(
await
object
.
text
()).
toBe
(
'
1
'
)
const
checkTypeArr
=
await
page
.
$
(
'
#check-type-arr
'
)
expect
(
(
await
checkTypeArr
.
text
()).
replaceAll
(
'
\n
'
,
''
)).
toBe
(
'
arr: ["a","b","c"]
'
)
expect
(
await
checkTypeArr
.
text
(
)).
toBe
(
'
arr: ["a","b","c"]
'
)
const
fooArr
=
await
page
.
$
(
'
#foo-arr
'
)
expect
(
(
await
fooArr
.
text
()).
replaceAll
(
'
\n
'
,
''
)).
toBe
(
'
arr: [1,2,3]
'
)
expect
(
await
fooArr
.
text
(
)).
toBe
(
'
arr: [1,2,3]
'
)
})
})
pages/composition-api/basic/define-slots/define-slots.test.js
浏览文件 @
a889ec1e
...
...
@@ -14,6 +14,6 @@ describe('defineSlots', () => {
expect
(
await
slotContent
.
text
()).
toBe
(
'
default slot num: 0
'
)
const
slotFooter
=
await
page
.
$
(
'
#slot-footer
'
)
expect
(
(
await
slotFooter
.
text
()).
replaceAll
(
'
\n
'
,
''
)).
toBe
(
'
footer slot arr: ["a","b","c"]
'
)
expect
(
await
slotFooter
.
text
(
)).
toBe
(
'
footer slot arr: ["a","b","c"]
'
)
})
})
\ No newline at end of file
pages/composition-api/dependency-injection/provide/provide-inject.test.js
浏览文件 @
a889ec1e
...
...
@@ -15,11 +15,11 @@ describe('provide-inject-hasInjectionContext', () => {
expect
(
await
num
.
text
()).
toBe
(
'
num: 0
'
)
const
obj
=
await
page
.
$
(
'
.obj
'
)
expect
(
await
obj
.
text
()).
toBe
(
isWeb
?
'
obj: {
\n
"a": 1
\n
}
'
:
'
obj: {"a":1}
'
)
expect
(
await
obj
.
text
()).
toBe
(
isWeb
?
'
obj: {
"a": 1
}
'
:
'
obj: {"a":1}
'
)
const
arr
=
await
page
.
$
(
'
.arr
'
)
expect
(
await
arr
.
text
()).
toBe
(
isWeb
?
'
arr: [
\n
1,
\n
2,
\n
3
\n
]
'
:
'
arr: [1,2,3]
'
)
expect
(
await
arr
.
text
()).
toBe
(
'
arr: [1,2,3]
'
)
const
fn
=
await
page
.
$
(
'
.fn
'
)
expect
(
await
fn
.
text
()).
toBe
(
'
fn: hello
'
)
...
...
pages/composition-api/lifecycle/component-lifecycle/component-lifecycle.test.js
浏览文件 @
a889ec1e
...
...
@@ -2,13 +2,6 @@ const PAGE_PATH = '/pages/composition-api/lifecycle/component-lifecycle/componen
const
HOME_PATH
=
'
/pages/tab-bar/options-api
'
describe
(
'
component-lifecycle
'
,
()
=>
{
if
(
process
.
env
.
uniTestPlatformInfo
.
startsWith
(
'
web
'
))
{
// TODO: 自动化测试暂不能调用web端setup内defineExpose导出的方法,待自动化测试兼容后开放此测试例
it
(
'
web
'
,
async
()
=>
{
expect
(
1
).
toBe
(
1
)
})
return
}
let
page
let
lifeCycleNum
beforeAll
(
async
()
=>
{
...
...
pages/composition-api/lifecycle/page-lifecycle/page-lifecycle.test.js
浏览文件 @
a889ec1e
...
...
@@ -6,7 +6,7 @@ let lifeCycleNum
describe
(
'
page-lifecycle
'
,
()
=>
{
if
(
process
.
env
.
uniTestPlatformInfo
.
startsWith
(
'
web
'
))
{
// TODO: 自动化测试暂不能调用web端setup内defineExpose导出的方法,待自动化测试兼容后开放此测试例
// TODO: onPageShow onPageHide 别名暂不支持
it
(
'
web
'
,
async
()
=>
{
expect
(
1
).
toBe
(
1
)
})
...
...
@@ -28,7 +28,7 @@ describe('page-lifecycle', () => {
page
=
await
program
.
reLaunch
(
PAGE_PATH
)
await
page
.
waitFor
(
700
)
lifeCycleNum
=
await
page
.
callMethod
(
'
getLifeCycleNum
'
)
expect
(
lifeCycleNum
).
toBe
(
1
3
0
)
expect
(
lifeCycleNum
).
toBe
(
1
2
0
)
await
page
.
callMethod
(
'
pageSetlifeCycleNum
'
,
0
)
})
it
(
'
onPullDownRefresh
'
,
async
()
=>
{
...
...
@@ -67,7 +67,7 @@ describe('page-lifecycle', () => {
page
=
await
program
.
navigateTo
(
PAGE_PATH
)
await
page
.
waitFor
(
700
)
lifeCycleNum
=
await
page
.
callMethod
(
'
getLifeCycleNum
'
)
expect
(
lifeCycleNum
).
toBe
(
1
3
0
)
expect
(
lifeCycleNum
).
toBe
(
1
2
0
)
page
=
await
program
.
navigateBack
()
await
page
.
waitFor
(
'
view
'
)
lifeCycleNum
=
await
page
.
callMethod
(
'
getLifeCycleNum
'
)
...
...
pages/composition-api/reactivity/computed/computed.test.js
浏览文件 @
a889ec1e
...
...
@@ -13,16 +13,16 @@ describe('computed', () => {
expect
(
await
doubleCount
.
text
()).
toBe
(
'
computed double count: 0
'
)
const
objArr
=
await
page
.
$
(
'
#obj-arr
'
)
expect
(
(
await
objArr
.
text
()).
replaceAll
(
'
\n
'
,
''
)).
toBe
(
'
obj.arr: [1,2,3]
'
)
expect
(
await
objArr
.
text
(
)).
toBe
(
'
obj.arr: [1,2,3]
'
)
const
objArrLen
=
await
page
.
$
(
'
#obj-arr-len
'
)
expect
(
await
objArrLen
.
text
()).
toBe
(
'
computed obj.arr.length: 3
'
)
const
updateBtn
=
await
page
.
$
(
'
.
update-btn
'
)
const
updateBtn
=
await
page
.
$
(
'
#
update-btn
'
)
await
updateBtn
.
tap
()
expect
(
await
count
.
text
()).
toBe
(
'
count: 1
'
)
expect
(
await
doubleCount
.
text
()).
toBe
(
'
computed double count: 2
'
)
expect
(
(
await
objArr
.
text
()).
replaceAll
(
'
\n
'
,
''
)).
toBe
(
'
obj.arr: [1,2,3,4]
'
)
expect
(
await
objArr
.
text
(
)).
toBe
(
'
obj.arr: [1,2,3,4]
'
)
expect
(
await
objArrLen
.
text
()).
toBe
(
'
computed obj.arr.length: 4
'
)
})
...
...
pages/composition-api/reactivity/computed/computed.uvue
浏览文件 @
a889ec1e
...
...
@@ -4,7 +4,7 @@
<text id="double-count" class="uni-common-mb">computed double count: {{ doubleCount }}</text>
<text id="obj-arr" class="uni-common-mb">obj.arr: {{ obj.arr }}</text>
<text id="obj-arr-len" class="uni-common-mb">computed obj.arr.length: {{ objArrLen }}</text>
<button
class
="update-btn" @click="update">update</button>
<button
id
="update-btn" @click="update">update</button>
</view>
</template>
...
...
pages/composition-api/reactivity/reactive/reactive.test.js
浏览文件 @
a889ec1e
...
...
@@ -17,7 +17,7 @@ describe('reactive', () => {
expect
(
await
objNum
.
text
()).
toBe
(
'
obj.num: 0
'
)
const
objArr
=
await
page
.
$
(
'
#obj-arr
'
)
expect
(
(
await
objArr
.
text
()).
replaceAll
(
'
\n
'
,
''
)).
toBe
(
'
obj.arr: ["a","b","c"]
'
)
expect
(
await
objArr
.
text
(
)).
toBe
(
'
obj.arr: ["a","b","c"]
'
)
const
updateBtn
=
await
page
.
$
(
'
.update-btn
'
)
await
updateBtn
.
tap
()
...
...
@@ -25,6 +25,6 @@ describe('reactive', () => {
expect
(
await
count
.
text
()).
toBe
(
'
count: 2
'
)
expect
(
await
objStr
.
text
()).
toBe
(
'
obj.str: new str
'
)
expect
(
await
objNum
.
text
()).
toBe
(
'
obj.num: 2
'
)
expect
(
(
await
objArr
.
text
()).
replaceAll
(
'
\n
'
,
''
)).
toBe
(
'
obj.arr: ["a","b","c","d"]
'
)
expect
(
await
objArr
.
text
(
)).
toBe
(
'
obj.arr: ["a","b","c","d"]
'
)
})
})
\ No newline at end of file
pages/composition-api/reactivity/readonly/readonly.test.js
浏览文件 @
a889ec1e
const
PAGE_PATH
=
'
/pages/composition-api/reactivity/readonly/readonly
'
describe
(
'
ref
'
,
()
=>
{
const
isWeb
=
process
.
env
.
uniTestPlatformInfo
.
startsWith
(
'
web
'
)
let
page
=
null
beforeAll
(
async
()
=>
{
page
=
await
program
.
reLaunch
(
PAGE_PATH
)
...
...
@@ -13,33 +12,33 @@ describe('ref', () => {
const
dataNum
=
await
page
.
$
(
'
#data-num
'
)
expect
(
await
dataNum
.
text
()).
toBe
(
'
data.num: 0
'
)
const
dataArr
=
await
page
.
$
(
'
#data-arr
'
)
expect
(
await
dataArr
.
text
()).
toBe
(
isWeb
?
'
data.arr: [
\n
"a",
\n
"b",
\n
"c"
\n
]
'
:
'
data.arr: ["a","b","c"]
'
)
expect
(
await
dataArr
.
text
()).
toBe
(
'
data.arr: ["a","b","c"]
'
)
const
readonlyDataStr
=
await
page
.
$
(
'
#readonly-data-str
'
)
expect
(
await
readonlyDataStr
.
text
()).
toBe
(
'
readonly data.str: default str
'
)
const
readonlyDataNum
=
await
page
.
$
(
'
#readonly-data-num
'
)
expect
(
await
readonlyDataNum
.
text
()).
toBe
(
'
readonly data.num: 0
'
)
const
readonlyDataArr
=
await
page
.
$
(
'
#readonly-data-arr
'
)
expect
(
await
readonlyDataArr
.
text
()).
toBe
(
isWeb
?
'
readonly data.arr: [
\n
"a",
\n
"b",
\n
"c"
\n
]
'
:
'
readonly data.arr: ["a","b","c"]
'
)
expect
(
await
readonlyDataArr
.
text
()).
toBe
(
'
readonly data.arr: ["a","b","c"]
'
)
const
updateDataBtn
=
await
page
.
$
(
'
#update-data-btn
'
)
await
updateDataBtn
.
tap
()
expect
(
await
dataStr
.
text
()).
toBe
(
'
data.str: new str
'
)
expect
(
await
dataNum
.
text
()).
toBe
(
'
data.num: 1
'
)
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
dataArr
.
text
()).
toBe
(
'
data.arr: ["a","b","c","d"]
'
)
expect
(
await
readonlyDataStr
.
text
()).
toBe
(
'
readonly data.str: new str
'
)
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
(
'
readonly data.arr: ["a","b","c","d"]
'
)
const
updateReadonlyDataBtn
=
await
page
.
$
(
'
#update-readonly-data-btn
'
)
await
updateReadonlyDataBtn
.
tap
()
expect
(
await
dataStr
.
text
()).
toBe
(
'
data.str: new str
'
)
expect
(
await
dataNum
.
text
()).
toBe
(
'
data.num: 1
'
)
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
dataArr
.
text
()).
toBe
(
'
data.arr: ["a","b","c","d"]
'
)
expect
(
await
readonlyDataStr
.
text
()).
toBe
(
'
readonly data.str: new str
'
)
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
(
'
readonly data.arr: ["a","b","c","d"]
'
)
})
})
\ No newline at end of file
pages/composition-api/reactivity/watch-effect/watch-effect.test.js
浏览文件 @
a889ec1e
...
...
@@ -76,7 +76,7 @@ describe('watchEffect', () => {
const
objBool
=
await
page
.
$
(
'
#obj-bool
'
)
expect
(
await
objBool
.
text
()).
toBe
(
'
obj.bool: false
'
)
const
objArr
=
await
page
.
$
(
'
#obj-arr
'
)
expect
(
(
await
objArr
.
text
()).
replaceAll
(
'
\n
'
,
''
)).
toBe
(
'
obj.arr: [0]
'
)
expect
(
await
objArr
.
text
(
)).
toBe
(
'
obj.arr: [0]
'
)
const
watchObjRes
=
await
page
.
$
(
'
#watch-obj-res
'
)
if
(
process
.
env
.
uniTestPlatformInfo
.
startsWith
(
'
android
'
))
{
...
...
@@ -104,7 +104,7 @@ describe('watchEffect', () => {
expect
(
await
objStr
.
text
()).
toBe
(
'
obj.str: num: 1
'
)
expect
(
await
objNum
.
text
()).
toBe
(
'
obj.num: 1
'
)
expect
(
await
objBool
.
text
()).
toBe
(
'
obj.bool: true
'
)
expect
(
(
await
objArr
.
text
()).
replaceAll
(
'
\n
'
,
''
)).
toBe
(
'
obj.arr: [0,1]
'
)
expect
(
await
objArr
.
text
(
)).
toBe
(
'
obj.arr: [0,1]
'
)
if
(
process
.
env
.
uniTestPlatformInfo
.
startsWith
(
'
android
'
))
{
expect
(
await
watchObjRes
.
text
()).
toBe
(
...
...
pages/composition-api/reactivity/watch-post-effect/watch-post-effect.test.js
浏览文件 @
a889ec1e
...
...
@@ -78,7 +78,7 @@ describe('watchPostEffect', () => {
const
objBool
=
await
page
.
$
(
'
#obj-bool
'
)
expect
(
await
objBool
.
text
()).
toBe
(
'
obj.bool: false
'
)
const
objArr
=
await
page
.
$
(
'
#obj-arr
'
)
expect
(
await
objArr
.
text
()).
toBe
(
isWeb
?
'
obj.arr: [
\n
0
\n
]
'
:
'
obj.arr: [0]
'
)
expect
(
await
objArr
.
text
()).
toBe
(
'
obj.arr: [0]
'
)
const
watchObjRes
=
await
page
.
$
(
'
#watch-obj-res
'
)
// TODO web端和安卓端JSON.stringify对属性的排序不一致
...
...
@@ -99,16 +99,16 @@ describe('watchPostEffect', () => {
expect
(
await
objStr
.
text
()).
toBe
(
'
obj.str: num: 1
'
)
expect
(
await
objNum
.
text
()).
toBe
(
'
obj.num: 1
'
)
expect
(
await
objBool
.
text
()).
toBe
(
'
obj.bool: true
'
)
expect
(
await
objArr
.
text
()).
toBe
(
isWeb
?
'
obj.arr: [
\n
0,
\n
1
\n
]
'
:
'
obj.arr: [0,1]
'
)
expect
(
await
objArr
.
text
()).
toBe
(
'
obj.arr: [0,1]
'
)
expect
(
await
watchObjRes
.
text
()).
toBe
(
isWeb
?
'
watch obj result: obj: {"num":
0,"str":"num: 0","bool":false,"arr":[0
]}
'
:
'
watch obj result: obj: {"num":
1,"str":"num: 1","bool":true,"arr":[0,1
]}
'
:
'
watch obj result: obj: {"arr":[0],"bool":false,"num":0,"str":"num: 0"}
'
)
expect
(
await
watchObjStrRes
.
text
()).
toBe
(
'
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
(
'
watch obj.arr result: arr: [0,1]
'
)
const
watchCountAndObjNumRes
=
await
page
.
$
(
'
#watch-count-obj-num-res
'
)
...
...
pages/composition-api/reactivity/watch-sync-effect/watch-sync-effect.test.js
浏览文件 @
a889ec1e
...
...
@@ -76,7 +76,7 @@ describe('watchSyncEffect', () => {
const
objBool
=
await
page
.
$
(
'
#obj-bool
'
)
expect
(
await
objBool
.
text
()).
toBe
(
'
obj.bool: false
'
)
const
objArr
=
await
page
.
$
(
'
#obj-arr
'
)
expect
(
await
objArr
.
text
()).
toBe
(
isWeb
?
'
obj.arr: [
\n
0
\n
]
'
:
'
obj.arr: [0]
'
)
expect
(
await
objArr
.
text
()).
toBe
(
'
obj.arr: [0]
'
)
const
watchObjRes
=
await
page
.
$
(
'
#watch-obj-res
'
)
expect
(
await
watchObjRes
.
text
()).
toBe
(
...
...
@@ -96,7 +96,7 @@ describe('watchSyncEffect', () => {
expect
(
await
objStr
.
text
()).
toBe
(
'
obj.str: num: 1
'
)
expect
(
await
objNum
.
text
()).
toBe
(
'
obj.num: 1
'
)
expect
(
await
objBool
.
text
()).
toBe
(
'
obj.bool: true
'
)
expect
(
await
objArr
.
text
()).
toBe
(
isWeb
?
'
obj.arr: [
\n
0,
\n
1
\n
]
'
:
'
obj.arr: [0,1]
'
)
expect
(
await
objArr
.
text
()).
toBe
(
'
obj.arr: [0,1]
'
)
expect
(
await
watchObjRes
.
text
()).
toBe
(
isWeb
?
...
...
pages/composition-api/reactivity/watch/watch.test.js
浏览文件 @
a889ec1e
...
...
@@ -81,7 +81,7 @@ describe('watch', () => {
const
objBool
=
await
page
.
$
(
'
#obj-bool
'
)
expect
(
await
objBool
.
text
()).
toBe
(
'
obj.bool: false
'
)
const
objArr
=
await
page
.
$
(
'
#obj-arr
'
)
expect
(
(
await
objArr
.
text
()).
replaceAll
(
'
\n
'
,
''
)).
toBe
(
'
obj.arr: [0]
'
)
expect
(
await
objArr
.
text
(
)).
toBe
(
'
obj.arr: [0]
'
)
const
watchObjRes
=
await
page
.
$
(
'
#watch-obj-res
'
)
if
(
process
.
env
.
uniTestPlatformInfo
.
startsWith
(
'
android
'
))
{
...
...
@@ -107,7 +107,7 @@ describe('watch', () => {
expect
(
await
objStr
.
text
()).
toBe
(
'
obj.str: num: 1
'
)
expect
(
await
objNum
.
text
()).
toBe
(
'
obj.num: 1
'
)
expect
(
await
objBool
.
text
()).
toBe
(
'
obj.bool: true
'
)
expect
(
(
await
objArr
.
text
()).
replaceAll
(
'
\n
'
,
''
)).
toBe
(
'
obj.arr: [0,1]
'
)
expect
(
await
objArr
.
text
(
)).
toBe
(
'
obj.arr: [0,1]
'
)
if
(
process
.
env
.
uniTestPlatformInfo
.
startsWith
(
'
android
'
))
{
expect
(
await
watchObjRes
.
text
()).
toBe
(
...
...
pages/composition/provide/provide-page2.test.js
浏览文件 @
a889ec1e
...
...
@@ -51,21 +51,21 @@ describe('函数方式创建 provide', () => {
const
providePageArrEl
=
await
page
.
$
(
'
.provide-page-arr
'
)
const
providePageArrText
=
await
providePageArrEl
.
text
()
expect
(
providePageArrText
).
toBe
(
isWeb
?
'
providePageArr: [
\n
"函数方式定义 provide page arr"
\n
]
'
:
'
providePageArr: ["函数方式定义 provide page arr"]
'
'
providePageArr: ["函数方式定义 provide page arr"]
'
)
})
it
(
'
map
'
,
async
()
=>
{
const
providePageMapEl
=
await
page
.
$
(
'
.provide-page-map
'
)
const
providePageMapText
=
await
providePageMapEl
.
text
()
expect
(
providePageMapText
).
toBe
(
isWeb
?
'
providePageMap: {
\n
"key": "函数方式定义 provide page map"
\n
}
'
:
'
providePageMap: {"key":"函数方式定义 provide page map"}
'
isWeb
?
'
providePageMap: {
"key": "函数方式定义 provide page map"
}
'
:
'
providePageMap: {"key":"函数方式定义 provide page map"}
'
)
})
it
(
'
set
'
,
async
()
=>
{
const
providePageSetEl
=
await
page
.
$
(
'
.provide-page-set
'
)
const
providePageSetText
=
await
providePageSetEl
.
text
()
expect
(
providePageSetText
).
toBe
(
isWeb
?
'
providePageSet: [
\n
"函数方式定义 provide page set"
\n
]
'
:
'
providePageSet: ["函数方式定义 provide page set"]
'
'
providePageSet: ["函数方式定义 provide page set"]
'
)
})
})
pages/composition/provide/provide.test.js
浏览文件 @
a889ec1e
...
...
@@ -51,21 +51,21 @@ describe('字面量方式创建 provide', () => {
const
providePageArrEl
=
await
page
.
$
(
'
.provide-page-arr
'
)
const
providePageArrText
=
await
providePageArrEl
.
text
()
expect
(
providePageArrText
).
toBe
(
isWeb
?
'
providePageArr: [
\n
"字面量方式定义 provide page arr"
\n
]
'
:
'
providePageArr: ["字面量方式定义 provide page arr"]
'
'
providePageArr: ["字面量方式定义 provide page arr"]
'
)
})
it
(
'
map
'
,
async
()
=>
{
const
providePageMapEl
=
await
page
.
$
(
'
.provide-page-map
'
)
const
providePageMapText
=
await
providePageMapEl
.
text
()
expect
(
providePageMapText
).
toBe
(
isWeb
?
'
providePageMap: {
\n
"key": "字面量方式定义 provide page map"
\n
}
'
:
'
providePageMap: {"key":"字面量方式定义 provide page map"}
'
isWeb
?
'
providePageMap: {
"key": "字面量方式定义 provide page map"
}
'
:
'
providePageMap: {"key":"字面量方式定义 provide page map"}
'
)
})
it
(
'
set
'
,
async
()
=>
{
const
providePageSetEl
=
await
page
.
$
(
'
.provide-page-set
'
)
const
providePageSetText
=
await
providePageSetEl
.
text
()
expect
(
providePageSetText
).
toBe
(
isWeb
?
'
providePageSet: [
\n
"字面量方式定义 provide page set"
\n
]
'
:
'
providePageSet: ["字面量方式定义 provide page set"]
'
'
providePageSet: ["字面量方式定义 provide page set"]
'
)
})
it
(
'
string default value
'
,
async
()
=>
{
...
...
pages/directive/v-model/v-model.test.js
浏览文件 @
a889ec1e
const
PAGE_PATH
=
'
/pages/directive/v-model/v-model
'
describe
(
'
v-model
'
,
()
=>
{
if
(
process
.
env
.
uniTestPlatformInfo
.
startsWith
(
'
web
'
))
{
// TODO: web 自动化测试InputElement input方法报错
it
(
'
web
'
,
async
()
=>
{
expect
(
1
).
toBe
(
1
)
})
return
}
let
page
beforeAll
(
async
()
=>
{
page
=
await
program
.
reLaunch
(
PAGE_PATH
)
...
...
@@ -17,10 +10,14 @@ describe('v-model', () => {
it
(
'
input
'
,
async
()
=>
{
const
value
=
Date
.
now
()
+
''
// TODO: 自动化测试web端存在问题
// 1. 直接获取 input 由于 web 端 input 为框架封装的自定义组件,所以被自动化测试框架识别为组定义组件,而不是 input element
// 2. 通过 class 获取标准 input element,自动化测试框架 isValidEl 限制只允许获取 uni element
if
(
process
.
env
.
uniTestPlatformInfo
.
startsWith
(
'
android
'
))
{
const
inputElement
=
await
page
.
$
(
'
.input
'
)
await
inputElement
.
input
(
value
)
const
inputValueElement
=
await
page
.
$
(
'
.input-value
'
)
expect
(
await
inputValueElement
.
text
()).
toBe
(
value
)
}
})
})
\ No newline at end of file
pages/lifecycle/page/page.test.js
浏览文件 @
a889ec1e
...
...
@@ -36,12 +36,7 @@ describe('page-lifecycle', () => {
page
=
await
program
.
reLaunch
(
PAGE_PATH
)
await
page
.
waitFor
(
700
)
lifeCycleNum
=
await
page
.
callMethod
(
'
getLifeCycleNum
'
)
// TODO 安卓端调整页面加载不触发onResize后调整此测试例
if
(
process
.
env
.
uniTestPlatformInfo
.
startsWith
(
'
android
'
))
{
expect
(
lifeCycleNum
).
toBe
(
130
)
}
else
if
(
process
.
env
.
uniTestPlatformInfo
.
startsWith
(
'
web
'
)){
expect
(
lifeCycleNum
).
toBe
(
120
)
}
await
page
.
callMethod
(
'
setLifeCycleNum
'
,
0
)
})
it
(
'
onPullDownRefresh
'
,
async
()
=>
{
...
...
@@ -80,17 +75,13 @@ describe('page-lifecycle', () => {
page
=
await
program
.
navigateTo
(
PAGE_PATH
)
await
page
.
waitFor
(
700
)
lifeCycleNum
=
await
page
.
callMethod
(
'
getLifeCycleNum
'
)
if
(
process
.
env
.
uniTestPlatformInfo
.
startsWith
(
'
android
'
))
{
expect
(
lifeCycleNum
).
toBe
(
130
)
}
else
if
(
process
.
env
.
uniTestPlatformInfo
.
startsWith
(
'
web
'
)){
expect
(
lifeCycleNum
).
toBe
(
120
)
}
page
=
await
program
.
navigateBack
()
await
page
.
waitFor
(
'
view
'
)
lifeCycleNum
=
await
page
.
callMethod
(
'
getLifeCycleNum
'
)
if
(
process
.
env
.
uniTestPlatformInfo
.
startsWith
(
'
android
'
))
{
expect
(
lifeCycleNum
).
toBe
(
20
)
}
else
if
(
process
.
env
.
uniTestPlatformInfo
.
startsWith
(
'
web
'
))
{
}
else
if
(
process
.
env
.
uniTestPlatformInfo
.
startsWith
(
'
web
'
))
{
expect
(
lifeCycleNum
).
toBe
(
10
)
}
await
page
.
callMethod
(
'
setLifeCycleNum
'
,
0
)
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录