mirror of
https://github.com/httprunner/httprunner.git
synced 2026-06-02 14:29:44 +08:00
refactor: move action options to pkg/uixt/options/action
This commit is contained in:
@@ -8,7 +8,6 @@ import (
|
||||
"github.com/stretchr/testify/assert"
|
||||
|
||||
hrp "github.com/httprunner/httprunner/v5"
|
||||
"github.com/httprunner/httprunner/v5/pkg/uixt"
|
||||
"github.com/httprunner/httprunner/v5/pkg/uixt/options"
|
||||
)
|
||||
|
||||
@@ -67,24 +66,26 @@ func TestIOSDouyinWorldCupLive(t *testing.T) {
|
||||
Home().
|
||||
AppTerminate("$appBundleID"). // 关闭已运行的抖音
|
||||
AppLaunch("$appBundleID").
|
||||
TapByOCR("我知道了", uixt.WithIgnoreNotFoundError(true)). // 处理青少年弹窗
|
||||
TapByOCR("我知道了", options.WithIgnoreNotFoundError(true)). // 处理青少年弹窗
|
||||
Validate().
|
||||
AssertOCRExists("首页", "抖音启动失败,「首页」不存在"),
|
||||
hrp.NewStep("点击首页").
|
||||
IOS().
|
||||
TapByOCR("首页", uixt.WithIndex(-1)).Sleep(2),
|
||||
TapByOCR("首页", options.WithIndex(-1)).Sleep(2),
|
||||
hrp.NewStep("点击世界杯页").
|
||||
IOS().
|
||||
SwipeToTapText("世界杯",
|
||||
uixt.WithMaxRetryTimes(5),
|
||||
uixt.WithCustomDirection(0.4, 0.07, 0.6, 0.07), // 滑动 tab,从左到右,解决「世界杯」被遮挡的问题
|
||||
uixt.WithScope(0, 0, 1, 0.15), // 限定 tab 区域
|
||||
uixt.WithInterval(1),
|
||||
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),
|
||||
),
|
||||
hrp.NewStep("点击进入赛程晋级").
|
||||
Loop(5). // 重复执行 5 次
|
||||
IOS().
|
||||
TapByOCR("赛程晋级", uixt.WithIdentifier("click_live"), uixt.WithIndex(-1)).
|
||||
TapByOCR("赛程晋级",
|
||||
options.WithIdentifier("click_live"),
|
||||
options.WithIndex(-1)).
|
||||
Sleep(3).Back().Sleep(3),
|
||||
hrp.NewStep("关闭抖音").
|
||||
IOS().
|
||||
|
||||
Reference in New Issue
Block a user