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
+11 -11
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 TestIOSDouyinLive(t *testing.T) {
@@ -16,9 +16,9 @@ func TestIOSDouyinLive(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,22 +26,22 @@ func TestIOSDouyinLive(t *testing.T) {
Home().
AppTerminate("com.ss.iphone.ugc.Aweme"). // 关闭已运行的抖音
SwipeToTapApp("$app_name",
options.WithMaxRetryTimes(5),
options.WithIdentifier("启动抖音")).Sleep(5).
option.WithMaxRetryTimes(5),
option.WithIdentifier("启动抖音")).Sleep(5).
Validate().
AssertOCRExists("推荐", "抖音启动失败,「推荐」不存在"),
hrp.NewStep("处理青少年弹窗").
IOS().
TapByOCR("我知道了", options.WithIgnoreNotFoundError(true)),
TapByOCR("我知道了", option.WithIgnoreNotFoundError(true)),
hrp.NewStep("向上滑动 2 次").
IOS().
SwipeUp(options.WithIdentifier("第一次上划")).Sleep(2).ScreenShot(). // 上划 1 次,等待 2s,截图保存
SwipeUp(options.WithIdentifier("第二次上划")).Sleep(2).ScreenShot(), // 再上划 1 次,等待 2s,截图保存
SwipeUp(option.WithIdentifier("第一次上划")).Sleep(2).ScreenShot(). // 上划 1 次,等待 2s,截图保存
SwipeUp(option.WithIdentifier("第二次上划")).Sleep(2).ScreenShot(), // 再上划 1 次,等待 2s,截图保存
hrp.NewStep("在推荐页上划,直到出现「点击进入直播间」").
IOS().
SwipeToTapText("点击进入直播间",
options.WithMaxRetryTimes(10),
options.WithIdentifier("进入直播间")),
option.WithMaxRetryTimes(10),
option.WithIdentifier("进入直播间")),
},
}