mirror of
https://github.com/httprunner/httprunner.git
synced 2026-08-28 03:30:01 +08:00
refactor: move uixt API
This commit is contained in:
@@ -6,6 +6,7 @@ import (
|
||||
"testing"
|
||||
|
||||
"github.com/httprunner/httprunner/v4/hrp"
|
||||
"github.com/httprunner/httprunner/v4/hrp/pkg/uixt"
|
||||
)
|
||||
|
||||
func TestWDALog(t *testing.T) {
|
||||
@@ -14,29 +15,38 @@ func TestWDALog(t *testing.T) {
|
||||
WithVariables(map[string]interface{}{
|
||||
"app_name": "抖音",
|
||||
}).
|
||||
SetIOS(hrp.WithLogOn(true), hrp.WithWDAPort(8700), hrp.WithWDAMjpegPort(8800)),
|
||||
SetIOS(
|
||||
uixt.WithWDALogOn(true),
|
||||
uixt.WithWDAPort(8700), uixt.WithWDAMjpegPort(8800),
|
||||
uixt.WithIOSPerfOptions(
|
||||
uixt.WithIOSPerfSystemCPU(true),
|
||||
uixt.WithIOSPerfSystemMem(true),
|
||||
uixt.WithIOSPerfNetwork(true),
|
||||
uixt.WithIOSPerfFPS(true),
|
||||
),
|
||||
),
|
||||
TestSteps: []hrp.IStep{
|
||||
hrp.NewStep("启动抖音").
|
||||
IOS().
|
||||
Home().
|
||||
AppTerminate("com.ss.iphone.ugc.Aweme"). // 关闭已运行的抖音
|
||||
SwipeToTapApp("$app_name", hrp.WithMaxRetryTimes(5), hrp.WithIdentifier("启动抖音")).Sleep(5).
|
||||
SwipeToTapApp("$app_name", uixt.WithMaxRetryTimes(5), uixt.WithIdentifier("启动抖音")).Sleep(5).
|
||||
Validate().
|
||||
AssertOCRExists("推荐", "抖音启动失败,「推荐」不存在"),
|
||||
hrp.NewStep("处理青少年弹窗").
|
||||
IOS().
|
||||
TapByOCR("我知道了", hrp.WithIgnoreNotFoundError(true)),
|
||||
TapByOCR("我知道了", uixt.WithIgnoreNotFoundError(true)),
|
||||
hrp.NewStep("进入购物页").
|
||||
IOS().TapByOCR("购物", hrp.WithIdentifier("点击购物")).Sleep(5),
|
||||
IOS().TapByOCR("商城", uixt.WithIdentifier("点击商城")).Sleep(5),
|
||||
hrp.NewStep("进入推荐页").
|
||||
IOS().TapByOCR("推荐", hrp.WithIdentifier("点击推荐")).Sleep(5),
|
||||
IOS().TapByOCR("推荐", uixt.WithIdentifier("点击推荐")).Sleep(5),
|
||||
hrp.NewStep("向上滑动 2 次").
|
||||
IOS().
|
||||
SwipeUp(hrp.WithIdentifier("第 1 次上划")).Sleep(2).
|
||||
SwipeUp(hrp.WithIdentifier("第 2 次上划")).Sleep(2).
|
||||
SwipeUp(hrp.WithIdentifier("第 3 次上划")).Sleep(2).
|
||||
TapXY(0.9, 0.1, hrp.WithIdentifier("点击进入搜索框")).Sleep(2).
|
||||
Input("httprunner", hrp.WithIdentifier("输入搜索关键词")),
|
||||
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("输入搜索关键词")),
|
||||
},
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user