Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
DCloud
hello uni-app x
提交
403fa446
H
hello uni-app x
项目概览
DCloud
/
hello uni-app x
通知
5995
Star
90
Fork
162
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
18
列表
看板
标记
里程碑
合并请求
1
DevOps
流水线
流水线任务
计划
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
H
hello uni-app x
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
18
Issue
18
列表
看板
标记
里程碑
合并请求
1
合并请求
1
Pages
DevOps
DevOps
流水线
流水线任务
计划
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
流水线任务
提交
Issue看板
提交
403fa446
编写于
9月 27, 2024
作者:
zhaofengliang920817
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
更新 overflow-visible-event 页面自动化脚本,支持iOS模拟点击手势。
上级
f26abe98
变更
2
隐藏空白更改
内联
并排
Showing
2 changed file
with
51 addition
and
13 deletion
+51
-13
pages/CSS/overflow/overflow-visible-event.test.js
pages/CSS/overflow/overflow-visible-event.test.js
+32
-6
pages/CSS/overflow/overflow-visible-event.uvue
pages/CSS/overflow/overflow-visible-event.uvue
+19
-7
未找到文件。
pages/CSS/overflow/overflow-visible-event.test.js
浏览文件 @
403fa446
// uni-app自动化测试教程: https://uniapp.dcloud.net.cn/worktile/auto/hbuilderx-extension/
// uni-app自动化测试教程: https://uniapp.dcloud.net.cn/worktile/auto/hbuilderx-extension/
describe
(
'
/pages/CSS/overflow/overflow-visible-event.uvue
'
,
()
=>
{
describe
(
'
/pages/CSS/overflow/overflow-visible-event.uvue
'
,
()
=>
{
if
(
!
process
.
env
.
uniTestPlatformInfo
.
startsWith
(
'
android
'
))
{
let
isAndroid
=
process
.
env
.
uniTestPlatformInfo
.
startsWith
(
'
android
'
)
if
(
!
process
.
env
.
uniTestPlatformInfo
.
startsWith
(
'
android
'
)
&&
!
process
.
env
.
uniTestPlatformInfo
.
toLowerCase
().
includes
(
'
ios
'
))
{
it
(
'
dummyTest
'
,
async
()
=>
{
it
(
'
dummyTest
'
,
async
()
=>
{
expect
(
1
).
toBe
(
1
)
expect
(
1
).
toBe
(
1
)
})
})
return
return
}
}
let
page
;
let
page
;
let
res
;
let
res
;
beforeAll
(
async
()
=>
{
beforeAll
(
async
()
=>
{
...
@@ -27,7 +27,11 @@ describe('/pages/CSS/overflow/overflow-visible-event.uvue', () => {
...
@@ -27,7 +27,11 @@ describe('/pages/CSS/overflow/overflow-visible-event.uvue', () => {
res
=
await
page
.
callMethod
(
'
jest_getRect
'
)
res
=
await
page
.
callMethod
(
'
jest_getRect
'
)
const
point_x
=
await
page
.
data
(
'
jest_click_x
'
);
const
point_x
=
await
page
.
data
(
'
jest_click_x
'
);
const
point_y
=
await
page
.
data
(
'
jest_click_y
'
);
const
point_y
=
await
page
.
data
(
'
jest_click_y
'
);
await
program
.
adbCommand
(
"
input tap
"
+
"
"
+
point_x
+
"
"
+
point_y
)
if
(
isAndroid
){
await
program
.
adbCommand
(
"
input tap
"
+
"
"
+
point_x
+
"
"
+
point_y
)
}
else
{
await
program
.
tap
({
x
:
point_x
,
y
:
point_y
})
}
await
page
.
waitFor
(
500
);
await
page
.
waitFor
(
500
);
res
=
await
page
.
data
(
'
jest_result
'
);
res
=
await
page
.
data
(
'
jest_result
'
);
expect
(
res
).
toBe
(
true
)
expect
(
res
).
toBe
(
true
)
...
@@ -41,7 +45,21 @@ describe('/pages/CSS/overflow/overflow-visible-event.uvue', () => {
...
@@ -41,7 +45,21 @@ describe('/pages/CSS/overflow/overflow-visible-event.uvue', () => {
const
distance
=
100
;
const
distance
=
100
;
const
destY
=
point_y
+
100
const
destY
=
point_y
+
100
const
duration
=
1000
const
duration
=
1000
await
program
.
adbCommand
(
"
input swipe
"
+
"
"
+
point_x
+
"
"
+
point_y
+
"
"
+
point_x
+
"
"
+
destY
+
"
"
+
duration
)
if
(
isAndroid
)
{
await
program
.
adbCommand
(
"
input swipe
"
+
"
"
+
point_x
+
"
"
+
point_y
+
"
"
+
point_x
+
"
"
+
destY
+
"
"
+
duration
)
}
else
{
await
program
.
swipe
({
startPoint
:
{
x
:
point_x
,
y
:
point_y
},
endPoint
:
{
x
:
point_x
,
y
:
destY
},
duration
:
duration
})
}
await
page
.
waitFor
(
1500
);
await
page
.
waitFor
(
1500
);
await
page
.
callMethod
(
'
jest_getParentRect
'
)
await
page
.
callMethod
(
'
jest_getParentRect
'
)
const
currentParentTop
=
await
page
.
data
(
'
jest_parent_top
'
);
const
currentParentTop
=
await
page
.
data
(
'
jest_parent_top
'
);
...
@@ -57,7 +75,11 @@ describe('/pages/CSS/overflow/overflow-visible-event.uvue', () => {
...
@@ -57,7 +75,11 @@ describe('/pages/CSS/overflow/overflow-visible-event.uvue', () => {
const
point_x
=
await
page
.
data
(
'
jest_click_x
'
);
const
point_x
=
await
page
.
data
(
'
jest_click_x
'
);
const
point_y
=
await
page
.
data
(
'
jest_click_y
'
);
const
point_y
=
await
page
.
data
(
'
jest_click_y
'
);
console
.
log
(
"
input tap
"
+
"
"
+
point_x
+
"
"
+
point_y
);
console
.
log
(
"
input tap
"
+
"
"
+
point_x
+
"
"
+
point_y
);
await
program
.
adbCommand
(
"
input tap
"
+
"
"
+
point_x
+
"
"
+
point_y
)
if
(
isAndroid
)
{
await
program
.
adbCommand
(
"
input tap
"
+
"
"
+
point_x
+
"
"
+
point_y
)
}
else
{
await
program
.
tap
({
x
:
point_x
,
y
:
point_y
})
}
await
page
.
waitFor
(
500
);
await
page
.
waitFor
(
500
);
res
=
await
page
.
data
(
'
jest_result
'
);
res
=
await
page
.
data
(
'
jest_result
'
);
expect
(
res
).
toBe
(
true
)
expect
(
res
).
toBe
(
true
)
...
@@ -69,7 +91,11 @@ describe('/pages/CSS/overflow/overflow-visible-event.uvue', () => {
...
@@ -69,7 +91,11 @@ describe('/pages/CSS/overflow/overflow-visible-event.uvue', () => {
const
point_x
=
await
page
.
data
(
'
jest_click_x
'
);
const
point_x
=
await
page
.
data
(
'
jest_click_x
'
);
const
point_y
=
await
page
.
data
(
'
jest_click_y
'
);
const
point_y
=
await
page
.
data
(
'
jest_click_y
'
);
console
.
log
(
"
input tap
"
+
"
"
+
point_x
+
"
"
+
point_y
);
console
.
log
(
"
input tap
"
+
"
"
+
point_x
+
"
"
+
point_y
);
await
program
.
adbCommand
(
"
input tap
"
+
"
"
+
point_x
+
"
"
+
point_y
)
if
(
isAndroid
)
{
await
program
.
adbCommand
(
"
input tap
"
+
"
"
+
point_x
+
"
"
+
point_y
)
}
else
{
await
program
.
tap
({
x
:
point_x
,
y
:
point_y
})
}
await
page
.
waitFor
(
500
);
await
page
.
waitFor
(
500
);
res
=
await
page
.
data
(
'
jest_result
'
);
res
=
await
page
.
data
(
'
jest_result
'
);
expect
(
res
).
toBe
(
true
)
expect
(
res
).
toBe
(
true
)
...
...
pages/CSS/overflow/overflow-visible-event.uvue
浏览文件 @
403fa446
...
@@ -100,7 +100,10 @@
...
@@ -100,7 +100,10 @@
jest_getRect() {
jest_getRect() {
const rect = uni.getElementById('child')?.getBoundingClientRect()
const rect = uni.getElementById('child')?.getBoundingClientRect()
if (rect != null) {
if (rect != null) {
const ratio = uni.getSystemInfoSync().devicePixelRatio
let ratio = 1
// #ifdef APP-ANDROID
ratio = uni.getSystemInfoSync().devicePixelRatio
// #endif
this.jest_click_x = rect.x * ratio + 10
this.jest_click_x = rect.x * ratio + 10
this.jest_click_y = rect.bottom * ratio - 10
this.jest_click_y = rect.bottom * ratio - 10
}
}
...
@@ -109,8 +112,11 @@
...
@@ -109,8 +112,11 @@
const transform = uni.getElementById('parent')?.style.getPropertyValue("transform")
const transform = uni.getElementById('parent')?.style.getPropertyValue("transform")
if (transform != null) {
if (transform != null) {
let value = transform as string
let value = transform as string
value = value.split(",")[1].slice(0, -3)
value = value.split(",")[1].slice(0, -3)
const ratio = uni.getSystemInfoSync().devicePixelRatio
let ratio = 1
// #ifdef APP-ANDROID
ratio = uni.getSystemInfoSync().devicePixelRatio
// #endif
this.jest_parent_top = Math.round((parseFloat(value) * ratio))
this.jest_parent_top = Math.round((parseFloat(value) * ratio))
}
}
},
},
...
@@ -118,8 +124,11 @@
...
@@ -118,8 +124,11 @@
const rect = uni.getElementById('absolute-view')?.getBoundingClientRect()
const rect = uni.getElementById('absolute-view')?.getBoundingClientRect()
if (rect != null) {
if (rect != null) {
const systemInfo = uni.getSystemInfoSync()
const systemInfo = uni.getSystemInfoSync()
const titleBarHeight = systemInfo.screenHeight - systemInfo.windowHeight
const titleBarHeight = systemInfo.screenHeight - systemInfo.windowHeight
const ratio = systemInfo.devicePixelRatio
let ratio = 1
// #ifdef APP-ANDROID
ratio = systemInfo.devicePixelRatio
// #endif
this.jest_click_x = rect.x * ratio + 10
this.jest_click_x = rect.x * ratio + 10
this.jest_click_y = (rect.top + titleBarHeight + 10) * ratio
this.jest_click_y = (rect.top + titleBarHeight + 10) * ratio
}
}
...
@@ -130,8 +139,11 @@
...
@@ -130,8 +139,11 @@
if (rect != null) {
if (rect != null) {
scrollView.scrollTo(0, rect.top)
scrollView.scrollTo(0, rect.top)
setTimeout(() => {
setTimeout(() => {
const systemInfo = uni.getSystemInfoSync()
const systemInfo = uni.getSystemInfoSync()
const ratio = systemInfo.devicePixelRatio
let ratio = 1
// #ifdef APP-ANDROID
ratio = systemInfo.devicePixelRatio
// #endif
const titleBarHeight = systemInfo.screenHeight - systemInfo.windowHeight
const titleBarHeight = systemInfo.screenHeight - systemInfo.windowHeight
const afterRect = uni.getElementById('deep-overflow')?.getBoundingClientRect()
const afterRect = uni.getElementById('deep-overflow')?.getBoundingClientRect()
if (afterRect != null) {
if (afterRect != null) {
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录