Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
Accustomed_
hello uni-app x
提交
febdb369
H
hello uni-app x
项目概览
Accustomed_
/
hello uni-app x
与 Fork 源项目一致
Fork自
DCloud / hello uni-app x
通知
1
Star
0
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
DevOps
流水线
流水线任务
计划
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
H
hello uni-app x
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
DevOps
DevOps
流水线
流水线任务
计划
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
流水线任务
提交
Issue看板
提交
febdb369
编写于
10月 25, 2023
作者:
DCloud-WZF
💬
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
test: 优化测试 waitFor 等待时间
上级
00efb758
变更
10
隐藏空白更改
内联
并排
Showing
10 changed file
with
44 addition
and
54 deletion
+44
-54
pages/API/get-element-by-id/get-element-by-id-multiple-root-node.test.js
...lement-by-id/get-element-by-id-multiple-root-node.test.js
+1
-1
pages/API/get-element-by-id/get-element-by-id.test.js
pages/API/get-element-by-id/get-element-by-id.test.js
+1
-1
pages/API/get-launch-options-sync/get-launch-options-sync.test.js
...I/get-launch-options-sync/get-launch-options-sync.test.js
+1
-1
pages/API/load-font-face/load-font-face-child.test.js
pages/API/load-font-face/load-font-face-child.test.js
+1
-1
pages/API/load-font-face/load-font-face.test.js
pages/API/load-font-face/load-font-face.test.js
+1
-1
pages/API/navigator/navigator.test.js
pages/API/navigator/navigator.test.js
+12
-22
pages/API/navigator/new-page/new-page-2.test.js
pages/API/navigator/new-page/new-page-2.test.js
+9
-9
pages/API/navigator/new-page/onLoad.test.js
pages/API/navigator/new-page/onLoad.test.js
+15
-15
pages/component/general-attribute/general-attribute.test.js
pages/component/general-attribute/general-attribute.test.js
+2
-2
pages/component/general-event/general-event.test.js
pages/component/general-event/general-event.test.js
+1
-1
未找到文件。
pages/API/get-element-by-id/get-element-by-id-multiple-root-node.test.js
浏览文件 @
febdb369
...
@@ -5,7 +5,7 @@ let page;
...
@@ -5,7 +5,7 @@ let page;
describe
(
"
getElementByIdForMultipleRootNode
"
,
()
=>
{
describe
(
"
getElementByIdForMultipleRootNode
"
,
()
=>
{
beforeAll
(
async
()
=>
{
beforeAll
(
async
()
=>
{
page
=
await
program
.
reLaunch
(
PAGE_PATH
);
page
=
await
program
.
reLaunch
(
PAGE_PATH
);
await
page
.
waitFor
(
1000
);
await
page
.
waitFor
(
'
view
'
);
});
});
it
(
"
getElementByNotExistId
"
,
async
()
=>
{
it
(
"
getElementByNotExistId
"
,
async
()
=>
{
const
res
=
await
page
.
callMethod
(
"
getElementByNotExistId
"
);
const
res
=
await
page
.
callMethod
(
"
getElementByNotExistId
"
);
...
...
pages/API/get-element-by-id/get-element-by-id.test.js
浏览文件 @
febdb369
...
@@ -4,7 +4,7 @@ let page;
...
@@ -4,7 +4,7 @@ let page;
describe
(
"
getElementById
"
,
()
=>
{
describe
(
"
getElementById
"
,
()
=>
{
beforeAll
(
async
()
=>
{
beforeAll
(
async
()
=>
{
page
=
await
program
.
reLaunch
(
PAGE_PATH
);
page
=
await
program
.
reLaunch
(
PAGE_PATH
);
await
page
.
waitFor
(
1000
);
await
page
.
waitFor
(
'
view
'
);
});
});
it
(
"
getElementByNotExistId
"
,
async
()
=>
{
it
(
"
getElementByNotExistId
"
,
async
()
=>
{
const
res
=
await
page
.
callMethod
(
"
getElementByNotExistId
"
);
const
res
=
await
page
.
callMethod
(
"
getElementByNotExistId
"
);
...
...
pages/API/get-launch-options-sync/get-launch-options-sync.test.js
浏览文件 @
febdb369
...
@@ -3,7 +3,7 @@ const PAGE_PATH = '/pages/API/get-launch-options-sync/get-launch-options-sync'
...
@@ -3,7 +3,7 @@ const PAGE_PATH = '/pages/API/get-launch-options-sync/get-launch-options-sync'
describe
(
'
getLaunchOptionsSync
'
,
()
=>
{
describe
(
'
getLaunchOptionsSync
'
,
()
=>
{
it
(
'
getLaunchOptionsSync
'
,
async
()
=>
{
it
(
'
getLaunchOptionsSync
'
,
async
()
=>
{
const
page
=
await
program
.
navigateTo
(
PAGE_PATH
)
const
page
=
await
program
.
navigateTo
(
PAGE_PATH
)
await
page
.
waitFor
(
1000
)
await
page
.
waitFor
(
'
view
'
)
await
page
.
callMethod
(
'
getLaunchOptionsSync
'
)
await
page
.
callMethod
(
'
getLaunchOptionsSync
'
)
const
data
=
await
page
.
data
()
const
data
=
await
page
.
data
()
expect
(
data
.
checked
).
toBe
(
true
)
expect
(
data
.
checked
).
toBe
(
true
)
...
...
pages/API/load-font-face/load-font-face-child.test.js
浏览文件 @
febdb369
...
@@ -3,7 +3,7 @@ const PAGE_PATH = '/pages/API/load-font-face/load-font-face-child'
...
@@ -3,7 +3,7 @@ const PAGE_PATH = '/pages/API/load-font-face/load-font-face-child'
describe
(
'
loadFontFace global
'
,
()
=>
{
describe
(
'
loadFontFace global
'
,
()
=>
{
beforeAll
(
async
()
=>
{
beforeAll
(
async
()
=>
{
const
page
=
await
program
.
navigateTo
(
PAGE_PATH
)
const
page
=
await
program
.
navigateTo
(
PAGE_PATH
)
await
page
.
waitFor
(
2000
)
await
page
.
waitFor
(
'
view
'
)
})
})
it
(
'
screenshot
'
,
async
()
=>
{
it
(
'
screenshot
'
,
async
()
=>
{
const
image
=
await
program
.
screenshot
()
const
image
=
await
program
.
screenshot
()
...
...
pages/API/load-font-face/load-font-face.test.js
浏览文件 @
febdb369
...
@@ -3,7 +3,7 @@ const PAGE_PATH = '/pages/API/load-font-face/load-font-face'
...
@@ -3,7 +3,7 @@ const PAGE_PATH = '/pages/API/load-font-face/load-font-face'
describe
(
'
loadFontFace
'
,
()
=>
{
describe
(
'
loadFontFace
'
,
()
=>
{
beforeAll
(
async
()
=>
{
beforeAll
(
async
()
=>
{
const
page
=
await
program
.
navigateTo
(
PAGE_PATH
)
const
page
=
await
program
.
navigateTo
(
PAGE_PATH
)
await
page
.
waitFor
(
4
000
)
await
page
.
waitFor
(
3
000
)
})
})
it
(
'
screenshot
'
,
async
()
=>
{
it
(
'
screenshot
'
,
async
()
=>
{
const
image
=
await
program
.
screenshot
()
const
image
=
await
program
.
screenshot
()
...
...
pages/API/navigator/navigator.test.js
浏览文件 @
febdb369
...
@@ -17,12 +17,12 @@ describe('navigator', () => {
...
@@ -17,12 +17,12 @@ describe('navigator', () => {
it
(
'
reLaunch
'
,
async
()
=>
{
it
(
'
reLaunch
'
,
async
()
=>
{
page
=
await
program
.
navigateTo
(
CURRENT_PAGE_PATH
)
page
=
await
program
.
navigateTo
(
CURRENT_PAGE_PATH
)
await
page
.
waitFor
(
500
)
await
page
.
waitFor
(
'
view
'
)
await
page
.
callMethod
(
'
setLifeCycleNum
'
,
0
)
await
page
.
callMethod
(
'
setLifeCycleNum
'
,
0
)
await
page
.
callMethod
(
'
reLaunch
'
)
await
page
.
callMethod
(
'
reLaunch
'
)
await
page
.
waitFor
(
500
)
await
page
.
waitFor
(
500
)
page
=
await
program
.
navigateTo
(
CURRENT_PAGE_PATH
)
page
=
await
program
.
navigateTo
(
CURRENT_PAGE_PATH
)
await
page
.
waitFor
(
500
)
await
page
.
waitFor
(
'
view
'
)
lifeCycleNum
=
await
page
.
callMethod
(
'
getLifeCycleNum
'
)
lifeCycleNum
=
await
page
.
callMethod
(
'
getLifeCycleNum
'
)
expect
(
lifeCycleNum
).
toBe
(
2
)
expect
(
lifeCycleNum
).
toBe
(
2
)
})
})
...
@@ -30,11 +30,11 @@ describe('navigator', () => {
...
@@ -30,11 +30,11 @@ describe('navigator', () => {
it
(
'
navigateTo
'
,
async
()
=>
{
it
(
'
navigateTo
'
,
async
()
=>
{
await
page
.
callMethod
(
'
setLifeCycleNum
'
,
0
)
await
page
.
callMethod
(
'
setLifeCycleNum
'
,
0
)
await
page
.
callMethod
(
'
navigateTo
'
)
await
page
.
callMethod
(
'
navigateTo
'
)
await
page
.
waitFor
(
500
)
await
page
.
waitFor
(
'
view
'
)
lifeCycleNum
=
await
page
.
callMethod
(
'
getLifeCycleNum
'
)
lifeCycleNum
=
await
page
.
callMethod
(
'
getLifeCycleNum
'
)
expect
(
lifeCycleNum
).
toBe
(
2
)
expect
(
lifeCycleNum
).
toBe
(
2
)
page
=
await
program
.
navigateBack
()
page
=
await
program
.
navigateBack
()
await
page
.
waitFor
(
500
)
await
page
.
waitFor
(
'
view
'
)
})
})
it
(
'
navigateTo error page
'
,
async
()
=>
{
it
(
'
navigateTo error page
'
,
async
()
=>
{
...
@@ -52,45 +52,41 @@ describe('navigator', () => {
...
@@ -52,45 +52,41 @@ describe('navigator', () => {
lifeCycleNum
=
await
page
.
callMethod
(
'
getLifeCycleNum
'
)
lifeCycleNum
=
await
page
.
callMethod
(
'
getLifeCycleNum
'
)
expect
(
lifeCycleNum
).
toBe
(
4
)
expect
(
lifeCycleNum
).
toBe
(
4
)
page
=
await
program
.
navigateBack
()
page
=
await
program
.
navigateBack
()
await
page
.
waitFor
(
500
)
await
page
.
waitFor
(
'
view
'
)
})
})
it
(
'
navigateTo relative path
'
,
async
()
=>
{
it
(
'
navigateTo relative path
'
,
async
()
=>
{
await
page
.
callMethod
(
'
setLifeCycleNum
'
,
0
)
await
page
.
callMethod
(
'
setLifeCycleNum
'
,
0
)
await
page
.
callMethod
(
'
navigateToRelativePath1
'
)
await
page
.
callMethod
(
'
navigateToRelativePath1
'
)
page
=
await
program
.
navigateBack
()
page
=
await
program
.
navigateBack
()
await
page
.
waitFor
(
500
)
await
page
.
waitFor
(
'
view
'
)
lifeCycleNum
=
await
page
.
callMethod
(
'
getLifeCycleNum
'
)
lifeCycleNum
=
await
page
.
callMethod
(
'
getLifeCycleNum
'
)
expect
(
lifeCycleNum
).
toBe
(
2
)
expect
(
lifeCycleNum
).
toBe
(
2
)
await
page
.
waitFor
(
500
)
})
})
it
(
'
navigateTo relative path ./
'
,
async
()
=>
{
it
(
'
navigateTo relative path ./
'
,
async
()
=>
{
await
page
.
callMethod
(
'
setLifeCycleNum
'
,
0
)
await
page
.
callMethod
(
'
setLifeCycleNum
'
,
0
)
await
page
.
callMethod
(
'
navigateToRelativePath2
'
)
await
page
.
callMethod
(
'
navigateToRelativePath2
'
)
page
=
await
program
.
navigateBack
()
page
=
await
program
.
navigateBack
()
await
page
.
waitFor
(
500
)
await
page
.
waitFor
(
'
view
'
)
lifeCycleNum
=
await
page
.
callMethod
(
'
getLifeCycleNum
'
)
lifeCycleNum
=
await
page
.
callMethod
(
'
getLifeCycleNum
'
)
expect
(
lifeCycleNum
).
toBe
(
2
)
expect
(
lifeCycleNum
).
toBe
(
2
)
await
page
.
waitFor
(
500
)
})
})
it
(
'
navigateTo relative path ../
'
,
async
()
=>
{
it
(
'
navigateTo relative path ../
'
,
async
()
=>
{
await
page
.
callMethod
(
'
setLifeCycleNum
'
,
0
)
await
page
.
callMethod
(
'
setLifeCycleNum
'
,
0
)
await
page
.
callMethod
(
'
navigateToRelativePath3
'
)
await
page
.
callMethod
(
'
navigateToRelativePath3
'
)
page
=
await
program
.
navigateBack
()
page
=
await
program
.
navigateBack
()
await
page
.
waitFor
(
500
)
await
page
.
waitFor
(
'
view
'
)
lifeCycleNum
=
await
page
.
callMethod
(
'
getLifeCycleNum
'
)
lifeCycleNum
=
await
page
.
callMethod
(
'
getLifeCycleNum
'
)
expect
(
lifeCycleNum
).
toBe
(
2
)
expect
(
lifeCycleNum
).
toBe
(
2
)
await
page
.
waitFor
(
500
)
})
})
it
(
'
navigateBack
'
,
async
()
=>
{
it
(
'
navigateBack
'
,
async
()
=>
{
await
page
.
callMethod
(
'
setLifeCycleNum
'
,
0
)
await
page
.
callMethod
(
'
setLifeCycleNum
'
,
0
)
await
page
.
callMethod
(
'
navigateBack
'
)
await
page
.
callMethod
(
'
navigateBack
'
)
await
page
.
waitFor
(
500
)
page
=
await
program
.
navigateTo
(
CURRENT_PAGE_PATH
)
page
=
await
program
.
navigateTo
(
CURRENT_PAGE_PATH
)
await
page
.
waitFor
(
500
)
await
page
.
waitFor
(
'
view
'
)
lifeCycleNum
=
await
page
.
callMethod
(
'
getLifeCycleNum
'
)
lifeCycleNum
=
await
page
.
callMethod
(
'
getLifeCycleNum
'
)
expect
(
lifeCycleNum
).
toBe
(
2
)
expect
(
lifeCycleNum
).
toBe
(
2
)
})
})
...
@@ -98,7 +94,6 @@ describe('navigator', () => {
...
@@ -98,7 +94,6 @@ describe('navigator', () => {
it
(
'
navigateBackWithDelta1
'
,
async
()
=>
{
it
(
'
navigateBackWithDelta1
'
,
async
()
=>
{
await
page
.
callMethod
(
'
setLifeCycleNum
'
,
0
)
await
page
.
callMethod
(
'
setLifeCycleNum
'
,
0
)
await
page
.
callMethod
(
'
navigateBackWithDelta1
'
)
await
page
.
callMethod
(
'
navigateBackWithDelta1
'
)
await
page
.
waitFor
(
1000
)
page
=
await
program
.
currentPage
()
page
=
await
program
.
currentPage
()
expect
(
`/
${
page
.
path
}
`
).
toBe
(
CURRENT_PAGE_PATH
)
expect
(
`/
${
page
.
path
}
`
).
toBe
(
CURRENT_PAGE_PATH
)
lifeCycleNum
=
await
page
.
callMethod
(
'
getLifeCycleNum
'
)
lifeCycleNum
=
await
page
.
callMethod
(
'
getLifeCycleNum
'
)
...
@@ -108,11 +103,8 @@ describe('navigator', () => {
...
@@ -108,11 +103,8 @@ describe('navigator', () => {
it
(
'
navigateBackWithDelta2
'
,
async
()
=>
{
it
(
'
navigateBackWithDelta2
'
,
async
()
=>
{
await
page
.
callMethod
(
'
setLifeCycleNum
'
,
0
)
await
page
.
callMethod
(
'
setLifeCycleNum
'
,
0
)
await
program
.
navigateTo
(
CHILD2_PAGE_PATH
)
await
program
.
navigateTo
(
CHILD2_PAGE_PATH
)
await
page
.
waitFor
(
500
)
page
=
await
program
.
navigateTo
(
CHILD1_PAGE_PATH
)
page
=
await
program
.
navigateTo
(
CHILD1_PAGE_PATH
)
await
page
.
waitFor
(
500
)
await
page
.
callMethod
(
'
navigateBackWithDelta2
'
)
await
page
.
callMethod
(
'
navigateBackWithDelta2
'
)
await
page
.
waitFor
(
500
)
page
=
await
program
.
currentPage
()
page
=
await
program
.
currentPage
()
expect
(
`/
${
page
.
path
}
`
).
toBe
(
CURRENT_PAGE_PATH
)
expect
(
`/
${
page
.
path
}
`
).
toBe
(
CURRENT_PAGE_PATH
)
lifeCycleNum
=
await
page
.
callMethod
(
'
getLifeCycleNum
'
)
lifeCycleNum
=
await
page
.
callMethod
(
'
getLifeCycleNum
'
)
...
@@ -123,8 +115,8 @@ describe('navigator', () => {
...
@@ -123,8 +115,8 @@ describe('navigator', () => {
page
=
await
program
.
reLaunch
(
CURRENT_PAGE_PATH
)
page
=
await
program
.
reLaunch
(
CURRENT_PAGE_PATH
)
await
page
.
callMethod
(
'
setLifeCycleNum
'
,
0
)
await
page
.
callMethod
(
'
setLifeCycleNum
'
,
0
)
await
page
.
callMethod
(
'
navigateBackWithDelta100
'
)
await
page
.
callMethod
(
'
navigateBackWithDelta100
'
)
await
page
.
waitFor
(
1000
)
page
=
await
program
.
currentPage
()
page
=
await
program
.
currentPage
()
await
page
.
waitFor
(
'
view
'
)
expect
(
`/
${
page
.
path
}
`
).
toBe
(
CURRENT_PAGE_PATH
)
expect
(
`/
${
page
.
path
}
`
).
toBe
(
CURRENT_PAGE_PATH
)
lifeCycleNum
=
await
page
.
callMethod
(
'
getLifeCycleNum
'
)
lifeCycleNum
=
await
page
.
callMethod
(
'
getLifeCycleNum
'
)
expect
(
lifeCycleNum
).
toBe
(
2
)
expect
(
lifeCycleNum
).
toBe
(
2
)
...
@@ -133,9 +125,8 @@ describe('navigator', () => {
...
@@ -133,9 +125,8 @@ describe('navigator', () => {
it
(
'
redirectTo
'
,
async
()
=>
{
it
(
'
redirectTo
'
,
async
()
=>
{
await
page
.
callMethod
(
'
setLifeCycleNum
'
,
0
)
await
page
.
callMethod
(
'
setLifeCycleNum
'
,
0
)
await
page
.
callMethod
(
'
redirectTo
'
)
await
page
.
callMethod
(
'
redirectTo
'
)
await
page
.
waitFor
(
500
)
page
=
await
program
.
redirectTo
(
CURRENT_PAGE_PATH
)
page
=
await
program
.
redirectTo
(
CURRENT_PAGE_PATH
)
await
page
.
waitFor
(
500
)
await
page
.
waitFor
(
'
view
'
)
lifeCycleNum
=
await
page
.
callMethod
(
'
getLifeCycleNum
'
)
lifeCycleNum
=
await
page
.
callMethod
(
'
getLifeCycleNum
'
)
expect
(
lifeCycleNum
).
toBe
(
2
)
expect
(
lifeCycleNum
).
toBe
(
2
)
})
})
...
@@ -144,9 +135,8 @@ describe('navigator', () => {
...
@@ -144,9 +135,8 @@ describe('navigator', () => {
page
=
await
program
.
reLaunch
(
CURRENT_PAGE_PATH
)
page
=
await
program
.
reLaunch
(
CURRENT_PAGE_PATH
)
await
page
.
callMethod
(
'
setLifeCycleNum
'
,
0
)
await
page
.
callMethod
(
'
setLifeCycleNum
'
,
0
)
await
page
.
callMethod
(
'
switchTab
'
)
await
page
.
callMethod
(
'
switchTab
'
)
await
page
.
waitFor
(
500
)
page
=
await
program
.
navigateTo
(
CURRENT_PAGE_PATH
)
page
=
await
program
.
navigateTo
(
CURRENT_PAGE_PATH
)
await
page
.
waitFor
(
500
)
await
page
.
waitFor
(
'
view
'
)
lifeCycleNum
=
await
page
.
callMethod
(
'
getLifeCycleNum
'
)
lifeCycleNum
=
await
page
.
callMethod
(
'
getLifeCycleNum
'
)
expect
(
lifeCycleNum
).
toBe
(
2
)
expect
(
lifeCycleNum
).
toBe
(
2
)
})
})
...
...
pages/API/navigator/new-page/new-page-2.test.js
浏览文件 @
febdb369
jest
.
setTimeout
(
3
0000
)
jest
.
setTimeout
(
2
0000
)
const
PAGE_PATH
=
'
/pages/API/navigator/new-page/new-page-2
'
const
PAGE_PATH
=
'
/pages/API/navigator/new-page/new-page-2
'
const
INTERMEDIATE_PAGE_PATH
=
'
/pages/API/navigator/navigator
'
const
INTERMEDIATE_PAGE_PATH
=
'
/pages/API/navigator/navigator
'
let
page
let
page
...
@@ -7,13 +7,13 @@ let lifeCycleNum
...
@@ -7,13 +7,13 @@ let lifeCycleNum
describe
(
'
app-lifecycle
'
,
()
=>
{
describe
(
'
app-lifecycle
'
,
()
=>
{
it
(
'
onLaunch onShow
'
,
async
()
=>
{
it
(
'
onLaunch onShow
'
,
async
()
=>
{
page
=
await
program
.
reLaunch
(
INTERMEDIATE_PAGE_PATH
)
page
=
await
program
.
reLaunch
(
INTERMEDIATE_PAGE_PATH
)
await
page
.
waitFor
(
1000
)
await
page
.
waitFor
(
'
view
'
)
lifeCycleNum
=
await
page
.
callMethod
(
'
getLifeCycleNum
'
)
lifeCycleNum
=
await
page
.
callMethod
(
'
getLifeCycleNum
'
)
expect
(
lifeCycleNum
).
toBe
(
1100
)
expect
(
lifeCycleNum
).
toBe
(
1100
)
})
})
it
(
'
onLastPageBackPress
'
,
async
()
=>
{
it
(
'
onLastPageBackPress
'
,
async
()
=>
{
page
=
await
program
.
navigateBack
()
page
=
await
program
.
navigateBack
()
await
page
.
waitFor
(
1000
)
await
page
.
waitFor
(
'
view
'
)
lifeCycleNum
=
await
page
.
callMethod
(
'
getLifeCycleNum
'
)
lifeCycleNum
=
await
page
.
callMethod
(
'
getLifeCycleNum
'
)
expect
(
lifeCycleNum
).
toBe
(
100
)
expect
(
lifeCycleNum
).
toBe
(
100
)
...
@@ -26,7 +26,7 @@ describe('app-lifecycle', () => {
...
@@ -26,7 +26,7 @@ describe('app-lifecycle', () => {
describe
(
'
page-lifecycle
'
,
()
=>
{
describe
(
'
page-lifecycle
'
,
()
=>
{
it
(
'
onLoad onShow onReady
'
,
async
()
=>
{
it
(
'
onLoad onShow onReady
'
,
async
()
=>
{
page
=
await
program
.
reLaunch
(
PAGE_PATH
)
page
=
await
program
.
reLaunch
(
PAGE_PATH
)
await
page
.
waitFor
(
1000
)
await
page
.
waitFor
(
'
view
'
)
lifeCycleNum
=
await
page
.
callMethod
(
'
getLifeCycleNum
'
)
lifeCycleNum
=
await
page
.
callMethod
(
'
getLifeCycleNum
'
)
expect
(
lifeCycleNum
).
toBe
(
120
)
expect
(
lifeCycleNum
).
toBe
(
120
)
await
page
.
callMethod
(
'
setLifeCycleNum
'
,
0
)
await
page
.
callMethod
(
'
setLifeCycleNum
'
,
0
)
...
@@ -48,28 +48,28 @@ describe('page-lifecycle', () => {
...
@@ -48,28 +48,28 @@ describe('page-lifecycle', () => {
})
})
it
(
'
onHide
'
,
async
()
=>
{
it
(
'
onHide
'
,
async
()
=>
{
page
=
await
program
.
navigateTo
(
INTERMEDIATE_PAGE_PATH
)
page
=
await
program
.
navigateTo
(
INTERMEDIATE_PAGE_PATH
)
await
page
.
waitFor
(
1000
)
await
page
.
waitFor
(
'
view
'
)
lifeCycleNum
=
await
page
.
callMethod
(
'
getLifeCycleNum
'
)
lifeCycleNum
=
await
page
.
callMethod
(
'
getLifeCycleNum
'
)
expect
(
lifeCycleNum
).
toBe
(
-
10
)
expect
(
lifeCycleNum
).
toBe
(
-
10
)
page
=
await
program
.
navigateBack
()
page
=
await
program
.
navigateBack
()
await
page
.
waitFor
(
1000
)
await
page
.
waitFor
(
'
view
'
)
lifeCycleNum
=
await
page
.
callMethod
(
'
getLifeCycleNum
'
)
lifeCycleNum
=
await
page
.
callMethod
(
'
getLifeCycleNum
'
)
expect
(
lifeCycleNum
).
toBe
(
0
)
expect
(
lifeCycleNum
).
toBe
(
0
)
})
})
it
(
'
onUnload
'
,
async
()
=>
{
it
(
'
onUnload
'
,
async
()
=>
{
page
=
await
program
.
redirectTo
(
INTERMEDIATE_PAGE_PATH
)
page
=
await
program
.
redirectTo
(
INTERMEDIATE_PAGE_PATH
)
await
page
.
waitFor
(
1000
)
await
page
.
waitFor
(
'
view
'
)
lifeCycleNum
=
await
page
.
callMethod
(
'
getLifeCycleNum
'
)
lifeCycleNum
=
await
page
.
callMethod
(
'
getLifeCycleNum
'
)
expect
(
lifeCycleNum
).
toBe
(
-
100
)
expect
(
lifeCycleNum
).
toBe
(
-
100
)
await
page
.
callMethod
(
'
setLifeCycleNum
'
,
0
)
await
page
.
callMethod
(
'
setLifeCycleNum
'
,
0
)
})
})
it
(
'
onBackPress
'
,
async
()
=>
{
it
(
'
onBackPress
'
,
async
()
=>
{
page
=
await
program
.
navigateTo
(
PAGE_PATH
)
page
=
await
program
.
navigateTo
(
PAGE_PATH
)
await
page
.
waitFor
(
1000
)
await
page
.
waitFor
(
'
view
'
)
lifeCycleNum
=
await
page
.
callMethod
(
'
getLifeCycleNum
'
)
lifeCycleNum
=
await
page
.
callMethod
(
'
getLifeCycleNum
'
)
expect
(
lifeCycleNum
).
toBe
(
120
)
expect
(
lifeCycleNum
).
toBe
(
120
)
page
=
await
program
.
navigateBack
()
page
=
await
program
.
navigateBack
()
await
page
.
waitFor
(
1000
)
await
page
.
waitFor
(
'
view
'
)
lifeCycleNum
=
await
page
.
callMethod
(
'
getLifeCycleNum
'
)
lifeCycleNum
=
await
page
.
callMethod
(
'
getLifeCycleNum
'
)
expect
(
lifeCycleNum
).
toBe
(
10
)
expect
(
lifeCycleNum
).
toBe
(
10
)
await
page
.
callMethod
(
'
setLifeCycleNum
'
,
0
)
await
page
.
callMethod
(
'
setLifeCycleNum
'
,
0
)
...
...
pages/API/navigator/new-page/onLoad.test.js
浏览文件 @
febdb369
...
@@ -7,50 +7,50 @@ let page;
...
@@ -7,50 +7,50 @@ let page;
describe
(
"
onLoad
"
,
()
=>
{
describe
(
"
onLoad
"
,
()
=>
{
it
(
"
adjustData
"
,
async
()
=>
{
it
(
"
adjustData
"
,
async
()
=>
{
page
=
await
program
.
reLaunch
(
INTERMEDIATE_PAGE_PATH
);
page
=
await
program
.
reLaunch
(
INTERMEDIATE_PAGE_PATH
);
await
page
.
waitFor
(
500
);
await
page
.
waitFor
(
'
view
'
);
await
page
.
callMethod
(
"
navigateToOnLoadWithType
"
,
"
adjustData
"
);
await
page
.
callMethod
(
"
navigateToOnLoadWithType
"
,
"
adjustData
"
);
await
page
.
waitFor
(
10
00
);
await
page
.
waitFor
(
5
00
);
const
image
=
await
program
.
screenshot
();
const
image
=
await
program
.
screenshot
();
expect
(
image
).
toMatchImageSnapshot
();
expect
(
image
).
toMatchImageSnapshot
();
});
});
it
(
"
navigateTo
"
,
async
()
=>
{
it
(
"
navigateTo
"
,
async
()
=>
{
page
=
await
program
.
reLaunch
(
INTERMEDIATE_PAGE_PATH
);
page
=
await
program
.
reLaunch
(
INTERMEDIATE_PAGE_PATH
);
await
page
.
waitFor
(
500
);
await
page
.
waitFor
(
'
view
'
);
await
page
.
callMethod
(
"
navigateToOnLoadWithType
"
,
"
navigateTo
"
);
await
page
.
callMethod
(
"
navigateToOnLoadWithType
"
,
"
navigateTo
"
);
await
page
.
waitFor
(
10
00
);
await
page
.
waitFor
(
5
00
);
page
=
await
program
.
currentPage
();
page
=
await
program
.
currentPage
();
expect
(
page
.
path
).
toBe
(
TARGET_PAGE_PATH
.
substring
(
1
));
expect
(
page
.
path
).
toBe
(
TARGET_PAGE_PATH
.
substring
(
1
));
});
});
it
(
"
navigateBack
"
,
async
()
=>
{
it
(
"
navigateBack
"
,
async
()
=>
{
page
=
await
program
.
reLaunch
(
INTERMEDIATE_PAGE_PATH
);
page
=
await
program
.
reLaunch
(
INTERMEDIATE_PAGE_PATH
);
await
page
.
waitFor
(
500
);
await
page
.
waitFor
(
'
view
'
);
await
page
.
callMethod
(
"
navigateToOnLoadWithType
"
,
"
navigateBack
"
);
await
page
.
callMethod
(
"
navigateToOnLoadWithType
"
,
"
navigateBack
"
);
await
page
.
waitFor
(
1000
);
page
=
await
program
.
currentPage
();
page
=
await
program
.
currentPage
();
await
page
.
waitFor
(
'
view
'
);
expect
(
page
.
path
).
toBe
(
INTERMEDIATE_PAGE_PATH
.
substring
(
1
));
expect
(
page
.
path
).
toBe
(
INTERMEDIATE_PAGE_PATH
.
substring
(
1
));
});
});
it
(
"
redirectTo
"
,
async
()
=>
{
it
(
"
redirectTo
"
,
async
()
=>
{
page
=
await
program
.
reLaunch
(
INTERMEDIATE_PAGE_PATH
);
page
=
await
program
.
reLaunch
(
INTERMEDIATE_PAGE_PATH
);
await
page
.
waitFor
(
500
);
await
page
.
waitFor
(
'
view
'
);
await
page
.
callMethod
(
"
navigateToOnLoadWithType
"
,
"
redirectTo
"
);
await
page
.
callMethod
(
"
navigateToOnLoadWithType
"
,
"
redirectTo
"
);
await
page
.
waitFor
(
10
00
);
await
page
.
waitFor
(
5
00
);
page
=
await
program
.
currentPage
();
page
=
await
program
.
currentPage
();
expect
(
page
.
path
).
toBe
(
TARGET_PAGE_PATH
.
substring
(
1
));
expect
(
page
.
path
).
toBe
(
TARGET_PAGE_PATH
.
substring
(
1
));
});
});
it
(
"
reLaunch
"
,
async
()
=>
{
it
(
"
reLaunch
"
,
async
()
=>
{
page
=
await
program
.
reLaunch
(
INTERMEDIATE_PAGE_PATH
);
page
=
await
program
.
reLaunch
(
INTERMEDIATE_PAGE_PATH
);
await
page
.
waitFor
(
500
);
await
page
.
waitFor
(
'
view
'
);
await
page
.
callMethod
(
"
navigateToOnLoadWithType
"
,
"
reLaunch
"
);
await
page
.
callMethod
(
"
navigateToOnLoadWithType
"
,
"
reLaunch
"
);
await
page
.
waitFor
(
10
00
);
await
page
.
waitFor
(
5
00
);
page
=
await
program
.
currentPage
();
page
=
await
program
.
currentPage
();
expect
(
page
.
path
).
toBe
(
TARGET_PAGE_PATH
.
substring
(
1
));
expect
(
page
.
path
).
toBe
(
TARGET_PAGE_PATH
.
substring
(
1
));
});
});
it
(
"
switchTab
"
,
async
()
=>
{
it
(
"
switchTab
"
,
async
()
=>
{
page
=
await
program
.
reLaunch
(
INTERMEDIATE_PAGE_PATH
);
page
=
await
program
.
reLaunch
(
INTERMEDIATE_PAGE_PATH
);
await
page
.
waitFor
(
500
);
await
page
.
waitFor
(
'
view
'
);
await
page
.
callMethod
(
"
navigateToOnLoadWithType
"
,
"
switchTab
"
);
await
page
.
callMethod
(
"
navigateToOnLoadWithType
"
,
"
switchTab
"
);
await
page
.
waitFor
(
1000
);
page
=
await
program
.
currentPage
();
page
=
await
program
.
currentPage
();
await
page
.
waitFor
(
'
view
'
);
expect
(
page
.
path
).
toBe
(
"
pages/tabBar/component
"
);
expect
(
page
.
path
).
toBe
(
"
pages/tabBar/component
"
);
});
});
// toast 出现在 INTERMEDIATE_PAGE_PATH 页面(非 onLoad 生命周期所在页面)
// toast 出现在 INTERMEDIATE_PAGE_PATH 页面(非 onLoad 生命周期所在页面)
...
@@ -66,7 +66,7 @@ describe("onLoad", () => {
...
@@ -66,7 +66,7 @@ describe("onLoad", () => {
// 同 toast
// 同 toast
// it("showLoading", async () => {
// it("showLoading", async () => {
// page = await program.reLaunch(INTERMEDIATE_PAGE_PATH);
// page = await program.reLaunch(INTERMEDIATE_PAGE_PATH);
// await page.waitFor(
500
);
// await page.waitFor(
'view'
);
// await page.callMethod("navigateToOnLoadWithType", "showLoading");
// await page.callMethod("navigateToOnLoadWithType", "showLoading");
// await page.waitFor(1000);
// await page.waitFor(1000);
// const image = await program.screenshot();
// const image = await program.screenshot();
...
@@ -75,7 +75,7 @@ describe("onLoad", () => {
...
@@ -75,7 +75,7 @@ describe("onLoad", () => {
// 同 toast
// 同 toast
// it("showModal", async () => {
// it("showModal", async () => {
// page = await program.reLaunch(INTERMEDIATE_PAGE_PATH);
// page = await program.reLaunch(INTERMEDIATE_PAGE_PATH);
// await page.waitFor(
500
);
// await page.waitFor(
'view'
);
// await page.callMethod("navigateToOnLoadWithType", "showModal");
// await page.callMethod("navigateToOnLoadWithType", "showModal");
// await page.waitFor(1000);
// await page.waitFor(1000);
// const image = await program.screenshot();
// const image = await program.screenshot();
...
@@ -84,7 +84,7 @@ describe("onLoad", () => {
...
@@ -84,7 +84,7 @@ describe("onLoad", () => {
// 同 toast
// 同 toast
// it("showActionSheet", async () => {
// it("showActionSheet", async () => {
// page = await program.reLaunch(INTERMEDIATE_PAGE_PATH);
// page = await program.reLaunch(INTERMEDIATE_PAGE_PATH);
// await page.waitFor(
500
);
// await page.waitFor(
'view'
);
// await page.callMethod("navigateToOnLoadWithType", "showActionSheet");
// await page.callMethod("navigateToOnLoadWithType", "showActionSheet");
// await page.waitFor(1000);
// await page.waitFor(1000);
// const image = await program.screenshot();
// const image = await program.screenshot();
...
...
pages/component/general-attribute/general-attribute.test.js
浏览文件 @
febdb369
...
@@ -5,7 +5,7 @@ describe('general attribute', () => {
...
@@ -5,7 +5,7 @@ describe('general attribute', () => {
beforeAll
(
async
()
=>
{
beforeAll
(
async
()
=>
{
page
=
await
program
.
navigateTo
(
PAGE_PATH
)
page
=
await
program
.
navigateTo
(
PAGE_PATH
)
await
page
.
waitFor
(
1000
)
await
page
.
waitFor
(
'
view
'
)
})
})
it
(
"
class & style
"
,
async
()
=>
{
it
(
"
class & style
"
,
async
()
=>
{
const
image
=
await
program
.
screenshot
();
const
image
=
await
program
.
screenshot
();
...
@@ -20,7 +20,7 @@ describe('general attribute', () => {
...
@@ -20,7 +20,7 @@ describe('general attribute', () => {
it
(
"
ref
"
,
async
()
=>
{
it
(
"
ref
"
,
async
()
=>
{
const
button
=
await
page
.
$
(
"
.btn-ref
"
);
const
button
=
await
page
.
$
(
"
.btn-ref
"
);
await
button
.
tap
();
await
button
.
tap
();
await
page
.
waitFor
(
10
00
);
await
page
.
waitFor
(
5
00
);
const
image
=
await
program
.
screenshot
();
const
image
=
await
program
.
screenshot
();
expect
(
image
).
toMatchImageSnapshot
();
expect
(
image
).
toMatchImageSnapshot
();
});
});
...
...
pages/component/general-event/general-event.test.js
浏览文件 @
febdb369
...
@@ -5,7 +5,7 @@ describe('event trigger sequence', () => {
...
@@ -5,7 +5,7 @@ describe('event trigger sequence', () => {
let
el
let
el
beforeAll
(
async
()
=>
{
beforeAll
(
async
()
=>
{
page
=
await
program
.
navigateTo
(
PAGE_PATH
)
page
=
await
program
.
navigateTo
(
PAGE_PATH
)
await
page
.
waitFor
(
1000
)
await
page
.
waitFor
(
'
view
'
)
el
=
await
page
.
$
(
'
.target
'
)
el
=
await
page
.
$
(
'
.target
'
)
})
})
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录