Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
DCloud
hello uni-app x
提交
605adab2
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看板
提交
605adab2
编写于
12月 03, 2024
作者:
DCloud-WZF
💬
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
test(global-events): 优化测试例
上级
76633616
变更
1
隐藏空白更改
内联
并排
Showing
1 changed file
with
68 addition
and
70 deletion
+68
-70
pages/component/global-events/global-events.test.js
pages/component/global-events/global-events.test.js
+68
-70
未找到文件。
pages/component/global-events/global-events.test.js
浏览文件 @
605adab2
...
...
@@ -41,7 +41,7 @@ describe('event trigger', () => {
screenX
:
101
,
screenY
:
101
},
],
})
})
await
page
.
waitFor
(
100
)
const
touchStartTouchTargetIdentifier
=
'
1
'
const
touchStartTouchTargetValue
=
'
101
'
...
...
@@ -94,7 +94,7 @@ describe('event trigger', () => {
screenX
:
102
,
screenY
:
102
},
],
})
})
await
page
.
waitFor
(
100
)
const
touchMoveTouchTargetIdentifier
=
'
1
'
...
...
@@ -147,7 +147,7 @@ describe('event trigger', () => {
screenX
:
103
,
screenY
:
103
},
],
})
})
await
page
.
waitFor
(
100
)
const
touchEndTouchTargetIdentifier
=
'
1
'
const
touchEndTouchTargetValue
=
'
103
'
...
...
@@ -182,21 +182,21 @@ describe('event trigger', () => {
}
})
it
(
'
click
'
,
async
()
=>
{
if
(
isMP
)
{
page
=
await
program
.
navigateTo
(
PAGE_PATH
)
await
page
.
waitFor
(
'
view
'
)
const
el
=
await
page
.
$
(
'
#longpress-target
'
)
await
el
.
tap
()
it
(
'
click
'
,
async
()
=>
{
if
(
isMP
)
{
page
=
await
program
.
navigateTo
(
PAGE_PATH
)
await
page
.
waitFor
(
'
view
'
)
const
el
=
await
page
.
$
(
'
#longpress-target
'
)
await
el
.
tap
()
await
page
.
waitFor
(
500
)
const
clickEventX
=
await
page
.
$
(
'
#click-event-x
'
)
expect
(
parseInt
(
await
clickEventX
.
text
())).
toBeGreaterThan
(
0
)
const
clickEventY
=
await
page
.
$
(
'
#click-event-y
'
)
expect
(
parseInt
(
await
clickEventY
.
text
())).
toBeGreaterThan
(
0
)
}
else
{
const
el
=
await
page
.
$
(
'
#longpress-target
'
)
await
el
.
tap
()
await
page
.
waitFor
(
100
)
}
else
{
const
el
=
await
page
.
$
(
'
#longpress-target
'
)
await
el
.
tap
()
await
page
.
waitFor
(
100
)
const
targetX
=
'
0
'
const
targetY
=
'
0
'
const
tapEventX
=
await
page
.
$
(
'
#tap-event-x
'
)
...
...
@@ -213,7 +213,7 @@ describe('event trigger', () => {
it
(
'
longPress
'
,
async
()
=>
{
if
(
!
process
.
env
.
UNI_AUTOMATOR_APP_WEBVIEW
)
{
const
el
=
await
page
.
$
(
'
#longpress-target
'
)
await
el
.
longpress
()
await
el
.
longpress
()
await
page
.
waitFor
(
100
)
if
(
isMP
)
{
const
longPressTouchIdentifier
=
await
page
.
$
(
'
#long-press-touch-identifier
'
)
...
...
@@ -267,65 +267,63 @@ describe('event trigger', () => {
expect
(
await
longPressChangedTouchScreenX
.
text
()).
toBe
(
longPressTouchTargetValue
)
const
longPressChangedTouchScreenY
=
await
page
.
$
(
'
#long-press-changed-touch-screen-y
'
)
expect
(
await
longPressChangedTouchScreenY
.
text
()).
toBe
(
longPressTouchTargetValue
)
}
if
(
isAndroid
||
isIos
)
{
const
longPressTouchTargetIdentifier
=
'
1
'
const
longPressTouchTargetValue
=
'
0
'
if
(
isIos
)
{
// 规避系统授权弹框
if
(
isAndroid
||
isIos
)
{
if
(
isIos
)
{
// 规避系统授权弹框
await
program
.
tap
({
x
:
100
,
y
:
500
,
})
}
await
program
.
tap
({
x
:
100
,
y
:
500
,
x
:
200
,
y
:
400
,
duration
:
1000
})
const
longPressTouchIdentifierText
=
await
longPressTouchIdentifier
.
text
()
expect
(
longPressTouchIdentifierText
).
not
.
toBe
(
longPressTouchTargetIdentifier
)
expect
(
longPressTouchIdentifierText
).
toBeTruthy
()
const
longPressTouchPageXText
=
await
longPressTouchPageX
.
text
()
expect
(
longPressTouchPageXText
).
not
.
toBe
(
longPressTouchTargetValue
)
expect
(
longPressTouchPageXText
).
toBeTruthy
()
const
longPressTouchPageYText
=
await
longPressTouchPageY
.
text
()
expect
(
longPressTouchPageYText
).
not
.
toBe
(
longPressTouchTargetValue
)
expect
(
longPressTouchPageYText
).
toBeTruthy
()
const
longPressTouchClientXText
=
await
longPressTouchClientX
.
text
()
expect
(
longPressTouchClientXText
).
not
.
toBe
(
longPressTouchTargetValue
)
expect
(
longPressTouchClientXText
).
toBeTruthy
()
const
longPressTouchClientYText
=
await
longPressTouchClientY
.
text
()
expect
(
longPressTouchClientYText
).
not
.
toBe
(
longPressTouchTargetValue
)
expect
(
longPressTouchClientYText
).
toBeTruthy
()
const
longPressTouchScreenXText
=
await
longPressTouchScreenX
.
text
()
expect
(
longPressTouchScreenXText
).
not
.
toBe
(
longPressTouchTargetValue
)
expect
(
longPressTouchScreenXText
).
toBeTruthy
()
const
longPressTouchScreenYText
=
await
longPressTouchScreenY
.
text
()
expect
(
longPressTouchScreenYText
).
not
.
toBe
(
longPressTouchTargetValue
)
expect
(
longPressTouchScreenYText
).
toBeTruthy
()
const
longPressChangedTouchIdentifierText
=
await
longPressChangedTouchIdentifier
.
text
()
expect
(
longPressChangedTouchIdentifierText
).
not
.
toBe
(
longPressTouchTargetIdentifier
)
expect
(
longPressChangedTouchIdentifierText
).
toBeTruthy
()
const
longPressChangedTouchPageXText
=
await
longPressChangedTouchPageX
.
text
()
expect
(
longPressChangedTouchPageXText
).
not
.
toBe
(
longPressTouchTargetValue
)
expect
(
longPressChangedTouchPageXText
).
toBeTruthy
()
const
longPressChangedTouchPageYText
=
await
longPressChangedTouchPageY
.
text
()
expect
(
longPressChangedTouchPageYText
).
not
.
toBe
(
longPressTouchTargetValue
)
expect
(
longPressChangedTouchPageYText
).
toBeTruthy
()
const
longPressChangedTouchClientXText
=
await
longPressChangedTouchClientX
.
text
()
expect
(
longPressChangedTouchClientXText
).
not
.
toBe
(
longPressTouchTargetValue
)
expect
(
longPressChangedTouchClientXText
).
toBeTruthy
()
const
longPressChangedTouchClientYText
=
await
longPressChangedTouchClientY
.
text
()
expect
(
longPressChangedTouchClientYText
).
not
.
toBe
(
longPressTouchTargetValue
)
expect
(
longPressChangedTouchClientYText
).
toBeTruthy
()
const
longPressChangedTouchScreenXText
=
await
longPressChangedTouchScreenX
.
text
()
expect
(
longPressChangedTouchScreenXText
).
not
.
toBe
(
longPressTouchTargetValue
)
expect
(
longPressChangedTouchScreenXText
).
toBeTruthy
()
const
longPressChangedTouchScreenYText
=
await
longPressChangedTouchScreenY
.
text
()
expect
(
longPressChangedTouchScreenYText
).
not
.
toBe
(
longPressTouchTargetValue
)
expect
(
longPressChangedTouchScreenYText
).
toBeTruthy
()
}
await
program
.
tap
({
x
:
200
,
y
:
400
,
duration
:
1000
})
const
longPressTouchIdentifierText
=
await
longPressTouchIdentifier
.
text
()
expect
(
longPressTouchIdentifierText
).
not
.
toBe
(
longPressTouchTargetIdentifier
)
expect
(
longPressTouchIdentifierText
).
toBeTruthy
()
const
longPressTouchPageXText
=
await
longPressTouchPageX
.
text
()
expect
(
longPressTouchPageXText
).
not
.
toBe
(
longPressTouchTargetValue
)
expect
(
longPressTouchPageXText
).
toBeTruthy
()
const
longPressTouchPageYText
=
await
longPressTouchPageY
.
text
()
expect
(
longPressTouchPageYText
).
not
.
toBe
(
longPressTouchTargetValue
)
expect
(
longPressTouchPageYText
).
toBeTruthy
()
const
longPressTouchClientXText
=
await
longPressTouchClientX
.
text
()
expect
(
longPressTouchClientXText
).
not
.
toBe
(
longPressTouchTargetValue
)
expect
(
longPressTouchClientXText
).
toBeTruthy
()
const
longPressTouchClientYText
=
await
longPressTouchClientY
.
text
()
expect
(
longPressTouchClientYText
).
not
.
toBe
(
longPressTouchTargetValue
)
expect
(
longPressTouchClientYText
).
toBeTruthy
()
const
longPressTouchScreenXText
=
await
longPressTouchScreenX
.
text
()
expect
(
longPressTouchScreenXText
).
not
.
toBe
(
longPressTouchTargetValue
)
expect
(
longPressTouchScreenXText
).
toBeTruthy
()
const
longPressTouchScreenYText
=
await
longPressTouchScreenY
.
text
()
expect
(
longPressTouchScreenYText
).
not
.
toBe
(
longPressTouchTargetValue
)
expect
(
longPressTouchScreenYText
).
toBeTruthy
()
const
longPressChangedTouchIdentifierText
=
await
longPressChangedTouchIdentifier
.
text
()
expect
(
longPressChangedTouchIdentifierText
).
not
.
toBe
(
longPressTouchTargetIdentifier
)
expect
(
longPressChangedTouchIdentifierText
).
toBeTruthy
()
const
longPressChangedTouchPageXText
=
await
longPressChangedTouchPageX
.
text
()
expect
(
longPressChangedTouchPageXText
).
not
.
toBe
(
longPressTouchTargetValue
)
expect
(
longPressChangedTouchPageXText
).
toBeTruthy
()
const
longPressChangedTouchPageYText
=
await
longPressChangedTouchPageY
.
text
()
expect
(
longPressChangedTouchPageYText
).
not
.
toBe
(
longPressTouchTargetValue
)
expect
(
longPressChangedTouchPageYText
).
toBeTruthy
()
const
longPressChangedTouchClientXText
=
await
longPressChangedTouchClientX
.
text
()
expect
(
longPressChangedTouchClientXText
).
not
.
toBe
(
longPressTouchTargetValue
)
expect
(
longPressChangedTouchClientXText
).
toBeTruthy
()
const
longPressChangedTouchClientYText
=
await
longPressChangedTouchClientY
.
text
()
expect
(
longPressChangedTouchClientYText
).
not
.
toBe
(
longPressTouchTargetValue
)
expect
(
longPressChangedTouchClientYText
).
toBeTruthy
()
const
longPressChangedTouchScreenXText
=
await
longPressChangedTouchScreenX
.
text
()
expect
(
longPressChangedTouchScreenXText
).
not
.
toBe
(
longPressTouchTargetValue
)
expect
(
longPressChangedTouchScreenXText
).
toBeTruthy
()
const
longPressChangedTouchScreenYText
=
await
longPressChangedTouchScreenY
.
text
()
expect
(
longPressChangedTouchScreenYText
).
not
.
toBe
(
longPressTouchTargetValue
)
expect
(
longPressChangedTouchScreenYText
).
toBeTruthy
()
}
}
})
...
...
@@ -363,4 +361,4 @@ describe('event trigger', () => {
expect
(
1
).
toBe
(
1
)
}
})
})
})
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录