refactor: rename options pkg to option

This commit is contained in:
lilong.129
2025-02-06 17:50:09 +08:00
parent b22f24cb6b
commit 194b61718f
61 changed files with 554 additions and 548 deletions
+15 -15
View File
@@ -6,7 +6,7 @@ import (
"testing"
hrp "github.com/httprunner/httprunner/v5"
"github.com/httprunner/httprunner/v5/pkg/uixt/options"
"github.com/httprunner/httprunner/v5/pkg/uixt/option"
)
func TestIOSDouyinFollowLive(t *testing.T) {
@@ -16,9 +16,9 @@ func TestIOSDouyinFollowLive(t *testing.T) {
"app_name": "抖音",
}).
SetIOS(
options.WithWDALogOn(true),
options.WithWDAPort(8700),
options.WithWDAMjpegPort(8800),
option.WithWDALogOn(true),
option.WithWDAPort(8700),
option.WithWDAMjpegPort(8800),
),
TestSteps: []hrp.IStep{
hrp.NewStep("启动抖音").
@@ -26,32 +26,32 @@ func TestIOSDouyinFollowLive(t *testing.T) {
Home().
AppTerminate("com.ss.iphone.ugc.Aweme"). // 关闭已运行的抖音
SwipeToTapApp("$app_name",
options.WithMaxRetryTimes(5),
options.WithIdentifier("启动抖音")).
option.WithMaxRetryTimes(5),
option.WithIdentifier("启动抖音")).
Sleep(5).
Validate().
AssertOCRExists("推荐", "抖音启动失败,「推荐」不存在"),
hrp.NewStep("处理青少年弹窗").
IOS().
TapByOCR("我知道了", options.WithIgnoreNotFoundError(true)),
TapByOCR("我知道了", option.WithIgnoreNotFoundError(true)),
hrp.NewStep("点击首页").
IOS().
TapByOCR("首页", options.WithIndex(-1)).Sleep(10),
TapByOCR("首页", option.WithIndex(-1)).Sleep(10),
hrp.NewStep("点击关注页").
IOS().
TapByOCR("关注", options.WithIndex(1)).Sleep(10),
TapByOCR("关注", option.WithIndex(1)).Sleep(10),
hrp.NewStep("向上滑动 2 次").
IOS().
SwipeToTapTexts([]string{"理肤泉", "婉宝"},
options.WithCustomDirection(0.6, 0.2, 0.2, 0.2),
options.WithIdentifier("click_live")).Sleep(10).
option.WithCustomDirection(0.6, 0.2, 0.2, 0.2),
option.WithIdentifier("click_live")).Sleep(10).
Swipe(0.9, 0.7, 0.9, 0.3,
options.WithIdentifier("slide_in_live"),
options.WithOffsetRandomRange(-10, 10)).
option.WithIdentifier("slide_in_live"),
option.WithOffsetRandomRange(-10, 10)).
Sleep(10).ScreenShot(). // 上划 1 次,等待 10s,截图保存
Swipe(0.9, 0.7, 0.9, 0.3,
options.WithIdentifier("slide_in_live"),
options.WithOffsetRandomRange(-10, 10)).
option.WithIdentifier("slide_in_live"),
option.WithOffsetRandomRange(-10, 10)).
Sleep(10).ScreenShot(), // 再上划 1 次,等待 10s,截图保存
},
}