fix: wda offset error by scale

This commit is contained in:
lilong.129
2025-07-02 22:03:40 +08:00
parent 65be9afe08
commit 7673a64184
5 changed files with 97 additions and 59 deletions

View File

@@ -30,7 +30,8 @@
"params": "$app_name",
"options": {
"identifier": "启动抖音",
"max_retry_times": 5
"max_retry_times": 5,
"pre_mark_operation": true
}
},
{
@@ -72,7 +73,8 @@
"method": "tap_ocr",
"params": "商城",
"options": {
"identifier": "点击商城"
"identifier": "点击商城",
"pre_mark_operation": true
}
},
{
@@ -90,11 +92,14 @@
{
"method": "tap_ocr",
"params": "推荐",
"identifier": "点击推荐",
"offset": [
0,
-1
]
"options": {
"identifier": "点击推荐",
"offset": [
0,
-1
],
"pre_mark_operation": true
}
},
{
"method": "sleep",
@@ -112,7 +117,8 @@
"method": "swipe_direction",
"params": "up",
"options": {
"identifier": "第 1 次上划"
"identifier": "第 1 次上划",
"pre_mark_operation": true
}
},
{
@@ -123,7 +129,8 @@
"method": "swipe_direction",
"params": "up",
"options": {
"identifier": "第 2 次上划"
"identifier": "第 2 次上划",
"pre_mark_operation": true
}
},
{
@@ -134,7 +141,8 @@
"method": "swipe_direction",
"params": "up",
"options": {
"identifier": "第 3 次上划"
"identifier": "第 3 次上划",
"pre_mark_operation": true
}
},
{
@@ -148,7 +156,8 @@
0.1
],
"options": {
"identifier": "点击进入搜索框"
"identifier": "点击进入搜索框",
"pre_mark_operation": true
}
},
{
@@ -159,7 +168,8 @@
"method": "input",
"params": "httprunner 发版记录",
"options": {
"identifier": "输入搜索关键词"
"identifier": "输入搜索关键词",
"pre_mark_operation": true
}
},
{

View File

@@ -27,23 +27,30 @@ func TestWDALog(t *testing.T) {
AppTerminate("com.ss.iphone.ugc.Aweme"). // 关闭已运行的抖音
SwipeToTapApp("$app_name",
option.WithMaxRetryTimes(5),
option.WithIdentifier("启动抖音")).Sleep(5).
option.WithIdentifier("启动抖音"),
option.WithPreMarkOperation(true)).Sleep(5).
Validate().
AssertOCRExists("推荐", "抖音启动失败,「推荐」不存在"),
hrp.NewStep("处理青少年弹窗").
IOS().
TapByOCR("我知道了", option.WithIgnoreNotFoundError(true)),
TapByOCR("我知道了",
option.WithIgnoreNotFoundError(true)),
hrp.NewStep("进入购物页").
IOS().TapByOCR("商城", option.WithIdentifier("点击商城")).Sleep(5),
IOS().TapByOCR("商城",
option.WithIdentifier("点击商城"),
option.WithPreMarkOperation(true)).Sleep(5),
hrp.NewStep("进入推荐页").
IOS().TapByOCR("推荐", option.WithIdentifier("点击推荐")).Sleep(5),
IOS().TapByOCR("推荐",
option.WithIdentifier("点击推荐"),
option.WithPreMarkOperation(true),
option.WithTapOffset(0, -1)).Sleep(5),
hrp.NewStep("向上滑动 2 次").
IOS().
SwipeUp(option.WithIdentifier("第 1 次上划")).Sleep(2).
SwipeUp(option.WithIdentifier("第 2 次上划")).Sleep(2).
SwipeUp(option.WithIdentifier("第 3 次上划")).Sleep(2).
TapXY(0.9, 0.1, option.WithIdentifier("点击进入搜索框")).Sleep(2).
Input("httprunner 发版记录", option.WithIdentifier("输入搜索关键词")).
SwipeUp(option.WithIdentifier("第 1 次上划"), option.WithPreMarkOperation(true)).Sleep(2).
SwipeUp(option.WithIdentifier("第 2 次上划"), option.WithPreMarkOperation(true)).Sleep(2).
SwipeUp(option.WithIdentifier("第 3 次上划"), option.WithPreMarkOperation(true)).Sleep(2).
TapXY(0.9, 0.1, option.WithIdentifier("点击进入搜索框"), option.WithPreMarkOperation(true)).Sleep(2).
Input("httprunner 发版记录", option.WithIdentifier("输入搜索关键词"), option.WithPreMarkOperation(true)).
TapByOCR("搜索", option.WithIdentifier("点击搜索")),
},
}