Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
DCloud
hello uni-app x
提交
6871defc
H
hello uni-app x
项目概览
DCloud
/
hello uni-app x
通知
6045
Star
91
Fork
165
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
19
列表
看板
标记
里程碑
合并请求
1
DevOps
流水线
流水线任务
计划
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
H
hello uni-app x
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
19
Issue
19
列表
看板
标记
里程碑
合并请求
1
合并请求
1
Pages
DevOps
DevOps
流水线
流水线任务
计划
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
流水线任务
提交
Issue看板
提交
6871defc
编写于
12月 03, 2024
作者:
DCloud-WZF
💬
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
test(dialogPage): 补充 closeDialogPage 后判断状态栏更新测试
上级
81b4f1ee
变更
2
隐藏空白更改
内联
并排
Showing
2 changed file
with
149 addition
and
109 deletion
+149
-109
pages.json
pages.json
+2
-1
pages/API/dialog-page/dialog-page.test.js
pages/API/dialog-page/dialog-page.test.js
+147
-108
未找到文件。
pages.json
浏览文件 @
6871defc
...
@@ -1512,7 +1512,8 @@
...
@@ -1512,7 +1512,8 @@
{
{
"path"
:
"pages/API/dialog-page/dialog-4"
,
"path"
:
"pages/API/dialog-page/dialog-4"
,
"style"
:
{
"style"
:
{
"navigationBarTitleText"
:
"dialogPage4"
"navigationBarTitleText"
:
"dialogPage4"
,
"navigationBarTextStyle"
:
"black"
}
}
},
},
//
#endif
//
#endif
...
...
pages/API/dialog-page/dialog-page.test.js
浏览文件 @
6871defc
...
@@ -3,6 +3,7 @@ jest.setTimeout(50000)
...
@@ -3,6 +3,7 @@ jest.setTimeout(50000)
const
platformInfo
=
process
.
env
.
uniTestPlatformInfo
.
toLocaleLowerCase
()
const
platformInfo
=
process
.
env
.
uniTestPlatformInfo
.
toLocaleLowerCase
()
const
isWeb
=
platformInfo
.
startsWith
(
'
web
'
)
const
isWeb
=
platformInfo
.
startsWith
(
'
web
'
)
const
isAndroid
=
platformInfo
.
startsWith
(
'
android
'
)
const
isAndroid
=
platformInfo
.
startsWith
(
'
android
'
)
const
isIos
=
platformInfo
.
startsWith
(
'
ios
'
)
const
isMP
=
platformInfo
.
startsWith
(
'
mp
'
)
const
isMP
=
platformInfo
.
startsWith
(
'
mp
'
)
const
FIRST_PAGE_PATH
=
'
/pages/API/dialog-page/dialog-page
'
const
FIRST_PAGE_PATH
=
'
/pages/API/dialog-page/dialog-page
'
const
NEXT_PAGE_PATH
=
'
/pages/API/dialog-page/next-page
'
const
NEXT_PAGE_PATH
=
'
/pages/API/dialog-page/next-page
'
...
@@ -15,10 +16,10 @@ describe('dialog page', () => {
...
@@ -15,10 +16,10 @@ describe('dialog page', () => {
return
return
}
}
if
(
isMP
)
{
if
(
isMP
)
{
it
(
'
skip mp
'
,
()
=>
{
it
(
'
skip mp
'
,
()
=>
{
expect
(
1
).
toBe
(
1
)
expect
(
1
).
toBe
(
1
)
})
})
return
return
}
}
let
page
;
let
page
;
...
@@ -201,7 +202,7 @@ describe('dialog page', () => {
...
@@ -201,7 +202,7 @@ describe('dialog page', () => {
await
page
.
callMethod
(
'
setLifeCycleNum
'
,
0
)
await
page
.
callMethod
(
'
setLifeCycleNum
'
,
0
)
})
})
it
(
'
openDialogPage to home page
'
,
async
()
=>
{
it
(
'
openDialogPage to home page
'
,
async
()
=>
{
// 本测试例中是在 FIRST_PAGE_PATH 中打开
// 本测试例中是在 FIRST_PAGE_PATH 中打开
await
page
.
callMethod
(
'
openDialogPage1ToHomePage
'
)
await
page
.
callMethod
(
'
openDialogPage1ToHomePage
'
)
await
page
.
waitFor
(
1000
)
await
page
.
waitFor
(
1000
)
...
@@ -227,7 +228,7 @@ describe('dialog page', () => {
...
@@ -227,7 +228,7 @@ describe('dialog page', () => {
expect
(
image
).
toSaveImageSnapshot
();
expect
(
image
).
toSaveImageSnapshot
();
lifecycleNum
=
await
page
.
callMethod
(
'
getLifeCycleNum
'
)
lifecycleNum
=
await
page
.
callMethod
(
'
getLifeCycleNum
'
)
// dialogPage2 onBackPress +1 dialogPage1 show +1 dialogPage unload -5*2 firstPage show +10
// dialogPage2 onBackPress +1 dialogPage1 show +1 dialogPage unload -5*2 firstPage show +10
expect
(
lifecycleNum
).
toBe
(
2
)
expect
(
lifecycleNum
).
toBe
(
2
)
await
page
.
callMethod
(
'
setLifeCycleNum
'
,
0
)
await
page
.
callMethod
(
'
setLifeCycleNum
'
,
0
)
})
})
...
@@ -298,111 +299,149 @@ describe('dialog page', () => {
...
@@ -298,111 +299,149 @@ describe('dialog page', () => {
});
});
expect
(
image5
).
toSaveImageSnapshot
();
expect
(
image5
).
toSaveImageSnapshot
();
lifecycleNum
=
await
page
.
callMethod
(
'
getLifeCycleNum
'
)
lifecycleNum
=
await
page
.
callMethod
(
'
getLifeCycleNum
'
)
expect
(
lifecycleNum
).
toBe
(
2
)
expect
(
lifecycleNum
).
toBe
(
2
)
await
page
.
callMethod
(
'
setLifeCycleNum
'
,
0
)
await
page
.
callMethod
(
'
setLifeCycleNum
'
,
0
)
})
it
(
'
check triggerParentHide
'
,
async
()
=>
{
// no triggerParentHide should not trigger parent hide
await
page
.
callMethod
(
'
openDialog4
'
)
await
page
.
waitFor
(
1000
)
if
(
isWeb
)
{
await
page
.
waitFor
(
2000
)
}
// dialog4 show +1
expect
(
await
page
.
callMethod
(
'
getLifeCycleNum
'
)).
toBe
(
1
)
await
page
.
callMethod
(
'
closeDialog
'
)
await
page
.
waitFor
(
200
)
// dialog4 unload -5 closeDialog callback +2
expect
(
await
page
.
callMethod
(
'
getLifeCycleNum
'
)).
toBe
(
-
2
)
// triggerParentHide should trigger parent hide
await
page
.
callMethod
(
'
openDialogWithTriggerParentHide
'
)
await
page
.
waitFor
(
1000
)
if
(
isWeb
)
{
await
page
.
waitFor
(
2000
)
}
// openDialog callback +2 dialog4 show +1 parent hide -10
expect
(
await
page
.
callMethod
(
'
getLifeCycleNum
'
)).
toBe
(
-
9
)
await
page
.
callMethod
(
'
closeDialog
'
)
await
page
.
waitFor
(
200
)
// dialog4 unload -5 parent show +10 closeDialog callback +2
expect
(
await
page
.
callMethod
(
'
getLifeCycleNum
'
)).
toBe
(
-
2
)
// triggerParentHide should trigger parent hide
await
page
.
callMethod
(
'
openDialogWithTriggerParentHide
'
)
await
page
.
waitFor
(
1000
)
if
(
isWeb
)
{
await
page
.
waitFor
(
2000
)
}
// openDialog callback +2 dialog4 show +1 parent hide -10
expect
(
await
page
.
callMethod
(
'
getLifeCycleNum
'
)).
toBe
(
-
9
)
// second triggerParentHide should not trigger parent hide
await
page
.
callMethod
(
'
openDialogWithTriggerParentHide
'
)
await
page
.
waitFor
(
1000
)
if
(
isWeb
)
{
await
page
.
waitFor
(
2000
)
}
// openDialog callback +2 dialog4 show +1
expect
(
await
page
.
callMethod
(
'
getLifeCycleNum
'
)).
toBe
(
-
6
)
await
page
.
callMethod
(
'
closeSpecifiedDialog
'
,
1
)
await
page
.
waitFor
(
200
)
// close not last triggerParentHide should not trigger parent show
// close callback +2 dialog4 unload -5 dialog4 show +1
expect
(
await
page
.
callMethod
(
'
getLifeCycleNum
'
)).
toBe
(
-
8
)
await
page
.
callMethod
(
'
closeSpecifiedDialog
'
,
0
)
await
page
.
waitFor
(
200
)
// close last triggerParentHide should trigger parent show
// close callback +2 dialog4 unload -5 parent show +10
expect
(
await
page
.
callMethod
(
'
getLifeCycleNum
'
)).
toBe
(
-
1
)
// no triggerParentHide should not trigger parent hide
await
page
.
callMethod
(
'
openDialog4
'
)
await
page
.
waitFor
(
1000
)
if
(
isWeb
)
{
await
page
.
waitFor
(
2000
)
}
// dialog4 show +1
expect
(
await
page
.
callMethod
(
'
getLifeCycleNum
'
)).
toBe
(
0
)
// triggerParentHide should trigger parent hide
await
page
.
callMethod
(
'
openDialogWithTriggerParentHide
'
)
await
page
.
waitFor
(
1000
)
if
(
isWeb
)
{
await
page
.
waitFor
(
2000
)
}
// openDialog callback +2 dialog4 show +1 parent hide -10
expect
(
await
page
.
callMethod
(
'
getLifeCycleNum
'
)).
toBe
(
-
7
)
// second triggerParentHide should not trigger parent hide
await
page
.
callMethod
(
'
openDialogWithTriggerParentHide
'
)
await
page
.
waitFor
(
1000
)
if
(
isWeb
)
{
await
page
.
waitFor
(
2000
)
}
// openDialog callback +2 dialog4 show +1
expect
(
await
page
.
callMethod
(
'
getLifeCycleNum
'
)).
toBe
(
-
4
)
// close middle triggerParentHide dialogPage
await
page
.
callMethod
(
'
closeSpecifiedDialog
'
,
1
)
await
page
.
waitFor
(
200
)
// close callback +2 dialog4 unload -5
expect
(
await
page
.
callMethod
(
'
getLifeCycleNum
'
)).
toBe
(
-
7
)
// close last triggerParentHide dialogPage shoud trigger parent show
await
page
.
callMethod
(
'
closeSpecifiedDialog
'
,
1
)
await
page
.
waitFor
(
200
)
// close callback +2 dialog4 unload -5 dialog4 show +1 parent show +10
expect
(
await
page
.
callMethod
(
'
getLifeCycleNum
'
)).
toBe
(
1
)
await
page
.
callMethod
(
'
closeDialog
'
)
await
page
.
waitFor
(
200
)
// close callback +2 dialog4 unload -5
expect
(
await
page
.
callMethod
(
'
getLifeCycleNum
'
)).
toBe
(
-
2
)
})
})
it
(
'
check triggerParentHide
'
,
async
()
=>
{
// no triggerParentHide should not trigger parent hide
await
page
.
callMethod
(
'
openDialog4
'
)
await
page
.
waitFor
(
1000
)
if
(
isWeb
)
{
await
page
.
waitFor
(
2000
)
}
// dialog4 show +1
expect
(
await
page
.
callMethod
(
'
getLifeCycleNum
'
)).
toBe
(
1
)
await
page
.
callMethod
(
'
closeDialog
'
)
await
page
.
waitFor
(
200
)
// dialog4 unload -5 closeDialog callback +2
expect
(
await
page
.
callMethod
(
'
getLifeCycleNum
'
)).
toBe
(
-
2
)
// triggerParentHide should trigger parent hide
await
page
.
callMethod
(
'
openDialogWithTriggerParentHide
'
)
await
page
.
waitFor
(
1000
)
if
(
isWeb
)
{
await
page
.
waitFor
(
2000
)
}
// openDialog callback +2 dialog4 show +1 parent hide -10
expect
(
await
page
.
callMethod
(
'
getLifeCycleNum
'
)).
toBe
(
-
9
)
await
page
.
callMethod
(
'
closeDialog
'
)
await
page
.
waitFor
(
200
)
// dialog4 unload -5 parent show +10 closeDialog callback +2
expect
(
await
page
.
callMethod
(
'
getLifeCycleNum
'
)).
toBe
(
-
2
)
// triggerParentHide should trigger parent hide
await
page
.
callMethod
(
'
openDialogWithTriggerParentHide
'
)
await
page
.
waitFor
(
1000
)
if
(
isWeb
)
{
await
page
.
waitFor
(
2000
)
}
// openDialog callback +2 dialog4 show +1 parent hide -10
expect
(
await
page
.
callMethod
(
'
getLifeCycleNum
'
)).
toBe
(
-
9
)
// second triggerParentHide should not trigger parent hide
await
page
.
callMethod
(
'
openDialogWithTriggerParentHide
'
)
await
page
.
waitFor
(
1000
)
if
(
isWeb
)
{
await
page
.
waitFor
(
2000
)
}
// openDialog callback +2 dialog4 show +1
expect
(
await
page
.
callMethod
(
'
getLifeCycleNum
'
)).
toBe
(
-
6
)
await
page
.
callMethod
(
'
closeSpecifiedDialog
'
,
1
)
await
page
.
waitFor
(
200
)
// close not last triggerParentHide should not trigger parent show
// close callback +2 dialog4 unload -5 dialog4 show +1
expect
(
await
page
.
callMethod
(
'
getLifeCycleNum
'
)).
toBe
(
-
8
)
await
page
.
callMethod
(
'
closeSpecifiedDialog
'
,
0
)
await
page
.
waitFor
(
200
)
// close last triggerParentHide should trigger parent show
// close callback +2 dialog4 unload -5 parent show +10
expect
(
await
page
.
callMethod
(
'
getLifeCycleNum
'
)).
toBe
(
-
1
)
// no triggerParentHide should not trigger parent hide
await
page
.
callMethod
(
'
openDialog4
'
)
await
page
.
waitFor
(
1000
)
if
(
isWeb
)
{
await
page
.
waitFor
(
2000
)
}
// dialog4 show +1
expect
(
await
page
.
callMethod
(
'
getLifeCycleNum
'
)).
toBe
(
0
)
// triggerParentHide should trigger parent hide
await
page
.
callMethod
(
'
openDialogWithTriggerParentHide
'
)
await
page
.
waitFor
(
1000
)
if
(
isWeb
)
{
await
page
.
waitFor
(
2000
)
}
// openDialog callback +2 dialog4 show +1 parent hide -10
expect
(
await
page
.
callMethod
(
'
getLifeCycleNum
'
)).
toBe
(
-
7
)
// second triggerParentHide should not trigger parent hide
await
page
.
callMethod
(
'
openDialogWithTriggerParentHide
'
)
await
page
.
waitFor
(
1000
)
if
(
isWeb
)
{
await
page
.
waitFor
(
2000
)
}
// openDialog callback +2 dialog4 show +1
expect
(
await
page
.
callMethod
(
'
getLifeCycleNum
'
)).
toBe
(
-
4
)
// close middle triggerParentHide dialogPage
await
page
.
callMethod
(
'
closeSpecifiedDialog
'
,
1
)
await
page
.
waitFor
(
200
)
// close callback +2 dialog4 unload -5
expect
(
await
page
.
callMethod
(
'
getLifeCycleNum
'
)).
toBe
(
-
7
)
// close last triggerParentHide dialogPage shoud trigger parent show
await
page
.
callMethod
(
'
closeSpecifiedDialog
'
,
1
)
await
page
.
waitFor
(
200
)
// close callback +2 dialog4 unload -5 dialog4 show +1 parent show +10
expect
(
await
page
.
callMethod
(
'
getLifeCycleNum
'
)).
toBe
(
1
)
await
page
.
callMethod
(
'
closeDialog
'
)
await
page
.
waitFor
(
200
)
// close callback +2 dialog4 unload -5
expect
(
await
page
.
callMethod
(
'
getLifeCycleNum
'
)).
toBe
(
-
2
)
})
if
(
isAndroid
||
isIos
)
{
it
(
'
after closeDialogPage reset statusBar color
'
,
async
()
=>
{
const
adbScreenShotArea
=
{
x
:
900
,
y
:
50
,
width
:
100
,
height
:
70
};
if
(
process
.
env
.
uniTestPlatformInfo
.
startsWith
(
'
android 6
'
))
{
adbScreenShotArea
.
x
=
535
adbScreenShotArea
.
width
=
90
adbScreenShotArea
.
height
=
50
}
else
if
(
process
.
env
.
uniTestPlatformInfo
.
startsWith
(
'
android 12
'
))
{
adbScreenShotArea
.
x
=
1160
adbScreenShotArea
.
width
=
70
adbScreenShotArea
.
height
=
80
}
await
page
.
callMethod
(
'
openDialog4
'
)
await
page
.
waitFor
(
1000
)
const
imageForDialog4
=
await
program
.
screenshot
({
deviceShot
:
true
,
area
:
adbScreenShotArea
,
});
expect
(
imageForDialog4
).
toSaveImageSnapshot
();
await
page
.
callMethod
(
'
closeDialog
'
)
await
page
.
waitFor
(
1000
)
const
imageForParent
=
await
program
.
screenshot
({
deviceShot
:
true
,
area
:
adbScreenShotArea
,
});
expect
(
imageForParent
).
toSaveImageSnapshot
();
})
}
it
(
'
input-hold-keyboard in dialog
'
,
async
()
=>
{
it
(
'
input-hold-keyboard in dialog
'
,
async
()
=>
{
await
page
.
callMethod
(
'
jest_OpenDialog1
'
)
await
page
.
callMethod
(
'
jest_OpenDialog1
'
)
await
page
.
waitFor
(
2000
);
await
page
.
waitFor
(
2000
);
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录