refactor: move action options to pkg/uixt/options/action

This commit is contained in:
lilong.129
2025-02-06 16:42:16 +08:00
parent f1ef161377
commit 0accec04a9
43 changed files with 982 additions and 911 deletions
+11 -10
View File
@@ -6,7 +6,6 @@ import (
"testing"
hrp "github.com/httprunner/httprunner/v5"
"github.com/httprunner/httprunner/v5/pkg/uixt"
"github.com/httprunner/httprunner/v5/pkg/uixt/options"
)
@@ -26,23 +25,25 @@ func TestWDALog(t *testing.T) {
IOS().
Home().
AppTerminate("com.ss.iphone.ugc.Aweme"). // 关闭已运行的抖音
SwipeToTapApp("$app_name", uixt.WithMaxRetryTimes(5), uixt.WithIdentifier("启动抖音")).Sleep(5).
SwipeToTapApp("$app_name",
options.WithMaxRetryTimes(5),
options.WithIdentifier("启动抖音")).Sleep(5).
Validate().
AssertOCRExists("推荐", "抖音启动失败,「推荐」不存在"),
hrp.NewStep("处理青少年弹窗").
IOS().
TapByOCR("我知道了", uixt.WithIgnoreNotFoundError(true)),
TapByOCR("我知道了", options.WithIgnoreNotFoundError(true)),
hrp.NewStep("进入购物页").
IOS().TapByOCR("商城", uixt.WithIdentifier("点击商城")).Sleep(5),
IOS().TapByOCR("商城", options.WithIdentifier("点击商城")).Sleep(5),
hrp.NewStep("进入推荐页").
IOS().TapByOCR("推荐", uixt.WithIdentifier("点击推荐")).Sleep(5),
IOS().TapByOCR("推荐", options.WithIdentifier("点击推荐")).Sleep(5),
hrp.NewStep("向上滑动 2 次").
IOS().
SwipeUp(uixt.WithIdentifier("第 1 次上划")).Sleep(2).
SwipeUp(uixt.WithIdentifier("第 2 次上划")).Sleep(2).
SwipeUp(uixt.WithIdentifier("第 3 次上划")).Sleep(2).
TapXY(0.9, 0.1, uixt.WithIdentifier("点击进入搜索框")).Sleep(2).
Input("httprunner", uixt.WithIdentifier("输入搜索关键词")),
SwipeUp(options.WithIdentifier("第 1 次上划")).Sleep(2).
SwipeUp(options.WithIdentifier("第 2 次上划")).Sleep(2).
SwipeUp(options.WithIdentifier("第 3 次上划")).Sleep(2).
TapXY(0.9, 0.1, options.WithIdentifier("点击进入搜索框")).Sleep(2).
Input("httprunner", options.WithIdentifier("输入搜索关键词")),
},
}