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
+13 -13
View File
@@ -8,7 +8,7 @@ import (
"github.com/stretchr/testify/assert"
hrp "github.com/httprunner/httprunner/v5"
"github.com/httprunner/httprunner/v5/pkg/uixt/options"
"github.com/httprunner/httprunner/v5/pkg/uixt/option"
)
func TestConvertTimeToSeconds(t *testing.T) {
@@ -55,10 +55,10 @@ func TestIOSDouyinWorldCupLive(t *testing.T) {
"appBundleID": "com.ss.iphone.ugc.Aweme",
}).
SetIOS(
options.WithUDID(uuid),
options.WithWDALogOn(true),
options.WithWDAPort(8700),
options.WithWDAMjpegPort(8800),
option.WithUDID(uuid),
option.WithWDALogOn(true),
option.WithWDAPort(8700),
option.WithWDAMjpegPort(8800),
),
TestSteps: []hrp.IStep{
hrp.NewStep("启动抖音").
@@ -66,26 +66,26 @@ func TestIOSDouyinWorldCupLive(t *testing.T) {
Home().
AppTerminate("$appBundleID"). // 关闭已运行的抖音
AppLaunch("$appBundleID").
TapByOCR("我知道了", options.WithIgnoreNotFoundError(true)). // 处理青少年弹窗
TapByOCR("我知道了", option.WithIgnoreNotFoundError(true)). // 处理青少年弹窗
Validate().
AssertOCRExists("首页", "抖音启动失败,「首页」不存在"),
hrp.NewStep("点击首页").
IOS().
TapByOCR("首页", options.WithIndex(-1)).Sleep(2),
TapByOCR("首页", option.WithIndex(-1)).Sleep(2),
hrp.NewStep("点击世界杯页").
IOS().
SwipeToTapText("世界杯",
options.WithMaxRetryTimes(5),
options.WithCustomDirection(0.4, 0.07, 0.6, 0.07), // 滑动 tab,从左到右,解决「世界杯」被遮挡的问题
options.WithScope(0, 0, 1, 0.15), // 限定 tab 区域
options.WithInterval(1),
option.WithMaxRetryTimes(5),
option.WithCustomDirection(0.4, 0.07, 0.6, 0.07), // 滑动 tab,从左到右,解决「世界杯」被遮挡的问题
option.WithScope(0, 0, 1, 0.15), // 限定 tab 区域
option.WithInterval(1),
),
hrp.NewStep("点击进入赛程晋级").
Loop(5). // 重复执行 5 次
IOS().
TapByOCR("赛程晋级",
options.WithIdentifier("click_live"),
options.WithIndex(-1)).
option.WithIdentifier("click_live"),
option.WithIndex(-1)).
Sleep(3).Back().Sleep(3),
hrp.NewStep("关闭抖音").
IOS().