change: bump version to v4.3.4

This commit is contained in:
lilong.129
2023-07-18 14:51:14 +08:00
parent e6ce45b821
commit c3a4e18f17
13 changed files with 3 additions and 629 deletions

View File

@@ -55,48 +55,3 @@ func TestAndroidVideoCrawlerTest(t *testing.T) {
t.Fatal(err)
}
}
func TestAndroidVideoCrawlerKSTest(t *testing.T) {
testCase := &hrp.TestCase{
Config: hrp.NewConfig("抓取 KS 视频信息").
WithVariables(map[string]interface{}{
"device": "${ENV(SerialNumber)}",
}).
SetAndroid(uixt.WithSerialNumber("$device")),
TestSteps: []hrp.IStep{
hrp.NewStep("滑动消费 feed 至少 100 个滑动过程中70% 随机间隔 0-5s30% 随机间隔 5-10s").
Android().
VideoCrawler(map[string]interface{}{
"app_package_name": "com.smile.gifmaker",
"timeout": 3600,
"feed": map[string]interface{}{
"target_count": 100,
"target_labels": []map[string]interface{}{
{"text": "^广告$", "scope": []float64{0, 0.5, 1, 1}, "regex": true},
{"text": "^推广$", "scope": []float64{0, 0.5, 1, 1}, "regex": true},
{"text": "^磁力广告$", "scope": []float64{0, 0.5, 1, 1}, "regex": true},
},
"sleep_random": []float64{0, 5, 0.7, 5, 10, 0.3},
},
"live": map[string]interface{}{
"target_count": 0,
"sleep_random": []float64{15, 20},
},
}),
hrp.NewStep("exit").
Android().
AppTerminate("com.smile.gifmaker").
Validate().
AssertAppNotInForeground("com.smile.gifmaker"),
},
}
if err := testCase.Dump2JSON("demo_android_video_ks_crawler.json"); err != nil {
t.Fatal(err)
}
err := hrp.Run(t, testCase)
if err != nil {
t.Fatal(err)
}
}

View File

@@ -1,98 +0,0 @@
{
"config": {
"name": "抓取 KS 视频信息",
"variables": {
"device": "${ENV(SerialNumber)}"
},
"android": [
{
"serial": "$device"
}
]
},
"teststeps": [
{
"name": "滑动消费 feed 至少 100 个滑动过程中70% 随机间隔 0-5s30% 随机间隔 5-10s",
"android": {
"actions": [
{
"method": "video_crawler",
"params": {
"app_package_name": "com.smile.gifmaker",
"feed": {
"sleep_random": [
0,
5,
0.7,
5,
10,
0.3
],
"target_count": 100,
"target_labels": [
{
"regex": true,
"scope": [
0,
0.5,
1,
1
],
"text": "^广告$"
},
{
"regex": true,
"scope": [
0,
0.5,
1,
1
],
"text": "^推广$"
},
{
"regex": true,
"scope": [
0,
0.5,
1,
1
],
"text": "^磁力广告$"
}
]
},
"live": {
"sleep_random": [
15,
20
],
"target_count": 0
},
"timeout": 3600
}
}
]
}
},
{
"name": "exit",
"android": {
"actions": [
{
"method": "app_terminate",
"params": "com.smile.gifmaker"
}
]
},
"validate": [
{
"check": "ui_foreground_app",
"assert": "not_equal",
"expect": "com.smile.gifmaker",
"msg": "app [com.smile.gifmaker] should not be in foreground"
}
]
}
]
}

View File

@@ -51,7 +51,7 @@ func TestWDALog(t *testing.T) {
},
}
if err := testCase.Dump2JSON("wda_log_data.json"); err != nil {
if err := testCase.Dump2JSON("demo_ios_wda_log.json"); err != nil {
t.Fatal(err)
}

View File

@@ -1,67 +0,0 @@
//go:build localtest
package uitest
import (
"testing"
"github.com/httprunner/httprunner/v4/hrp"
"github.com/httprunner/httprunner/v4/hrp/pkg/uixt"
)
func TestAndroidKuaiShouFeedCardLive(t *testing.T) {
testCase := &hrp.TestCase{
Config: hrp.NewConfig("直播_快手_Feed卡片_android").
WithVariables(map[string]interface{}{
"device": "${ENV(SerialNumber)}",
}).
SetAndroid(
uixt.WithSerialNumber("$device"),
uixt.WithAdbLogOn(true)),
TestSteps: []hrp.IStep{
hrp.NewStep("启动快手").
Android().
AppTerminate("com.smile.gifmaker").
AppLaunch("com.smile.gifmaker").
Home().
SwipeToTapApp("快手", uixt.WithMaxRetryTimes(5)).Sleep(10),
hrp.NewStep("处理青少年弹窗").
Android().
TapByOCR("我知道了", uixt.WithIgnoreNotFoundError(true)).
Validate().
AssertOCRExists("精选", "进入快手失败"),
hrp.NewStep("点击精选").
Android().
TapByOCR("精选", uixt.WithIndex(-1), uixt.WithOffset(0, -50)).Sleep(10),
hrp.NewStep("点击直播标签,进入直播间").
Android().
SwipeToTapText("点击进入直播间",
uixt.WithCustomDirection(0.9, 0.7, 0.9, 0.3),
uixt.WithScope(0.2, 0.5, 0.8, 0.8),
uixt.WithMaxRetryTimes(20),
uixt.WithInterval(60),
uixt.WithIdentifier("click_live"),
),
hrp.NewStep("等待1分钟").
Android().
Sleep(60),
hrp.NewStep("上滑进入下一个直播间").
Android().
Swipe(0.9, 0.7, 0.9, 0.3, uixt.WithIdentifier("slide_in_live")).Sleep(60),
hrp.NewStep("返回主界面,并打开本地时间戳").
Android().
Home().SwipeToTapApp("local", uixt.WithMaxRetryTimes(5)).Sleep(10).
Validate().
AssertOCRExists("16", "打开本地时间戳失败"),
},
}
if err := testCase.Dump2JSON("android_feed_card_live_test.json"); err != nil {
t.Fatal(err)
}
err := hrp.Run(t, testCase)
if err != nil {
t.Fatal(err)
}
}

View File

@@ -1,114 +0,0 @@
{
"config": {
"name": "通过 feed 卡片进入微信直播间",
"ios": [
{
"port": 8700,
"mjpeg_port": 8800,
"log_on": true
}
]
},
"teststeps": [
{
"name": "启动微信",
"ios": {
"actions": [
{
"method": "home"
},
{
"method": "app_terminate",
"params": "com.tencent.xin"
},
{
"method": "swipe_to_tap_app",
"params": "微信",
"max_retry_times": 5
}
]
},
"validate": [
{
"check": "ui_label",
"assert": "exists",
"expect": "通讯录",
"msg": "微信启动失败,「通讯录」不存在"
}
]
},
{
"name": "进入直播页",
"ios": {
"actions": [
{
"method": "tap",
"params": "发现"
},
{
"method": "tap_ocr",
"params": "视频号",
"identifier": "进入视频号",
"index": -1
}
]
}
},
{
"name": "处理青少年弹窗",
"ios": {
"actions": [
{
"method": "tap_ocr",
"params": "我知道了",
"ignore_NotFoundError": true
}
]
}
},
{
"name": "在推荐页上划,直到出现「轻触进入直播间」",
"ios": {
"actions": [
{
"method": "swipe_to_tap_text",
"params": "轻触进入直播间",
"identifier": "进入直播间",
"max_retry_times": 10
}
]
}
},
{
"name": "向上滑动,等待 10s",
"ios": {
"actions": [
{
"method": "swipe",
"params": "up",
"identifier": "第一次上划"
},
{
"method": "sleep",
"params": 10
},
{
"method": "screenshot"
},
{
"method": "swipe",
"params": "up",
"identifier": "第二次上划"
},
{
"method": "sleep",
"params": 10
},
{
"method": "screenshot"
}
]
}
}
]
}

View File

@@ -1,52 +0,0 @@
//go:build localtest
package uitest
import (
"testing"
"github.com/httprunner/httprunner/v4/hrp"
"github.com/httprunner/httprunner/v4/hrp/pkg/uixt"
)
func TestIOSWeixinLive(t *testing.T) {
testCase := &hrp.TestCase{
Config: hrp.NewConfig("通过 feed 卡片进入微信直播间").
SetIOS(uixt.WithWDALogOn(true), uixt.WithWDAPort(8700), uixt.WithWDAMjpegPort(8800)),
TestSteps: []hrp.IStep{
hrp.NewStep("启动微信").
IOS().
Home().
AppTerminate("com.tencent.xin"). // 关闭已运行的微信,确保启动微信后在「微信」首页
SwipeToTapApp("微信", uixt.WithMaxRetryTimes(5)).
Validate().
AssertLabelExists("通讯录", "微信启动失败,「通讯录」不存在"),
hrp.NewStep("进入直播页").
IOS().
Tap("发现"). // 进入「发现页」
TapByOCR("视频号", uixt.WithIdentifier("进入视频号"), uixt.WithIndex(-1)), // 通过 OCR 识别「视频号」
hrp.NewStep("处理青少年弹窗").
IOS().
TapByOCR("我知道了", uixt.WithIgnoreNotFoundError(true)),
hrp.NewStep("在推荐页上划,直到出现「轻触进入直播间」").
IOS().
SwipeToTapText("轻触进入直播间", uixt.WithMaxRetryTimes(10), uixt.WithIdentifier("进入直播间")),
hrp.NewStep("向上滑动,等待 10s").
IOS().
SwipeUp(uixt.WithIdentifier("第一次上划")).Sleep(10).ScreenShot(). // 上划 1 次,等待 10s截图保存
SwipeUp(uixt.WithIdentifier("第二次上划")).Sleep(10).ScreenShot(), // 再上划 1 次,等待 10s截图保存
},
}
if err := testCase.Dump2JSON("demo_weixin_live.json"); err != nil {
t.Fatal(err)
}
if err := testCase.Dump2YAML("demo_weixin_live.yaml"); err != nil {
t.Fatal(err)
}
err := hrp.Run(t, testCase)
if err != nil {
t.Fatal(err)
}
}

View File

@@ -1,61 +0,0 @@
//go:build localtest
package uitest
import (
"testing"
"github.com/httprunner/httprunner/v4/hrp"
"github.com/httprunner/httprunner/v4/hrp/pkg/uixt"
)
func TestIOSKuaiShouLive(t *testing.T) {
testCase := &hrp.TestCase{
Config: hrp.NewConfig("直播_快手_关注天窗_ios").
WithVariables(map[string]interface{}{
"device": "${ENV(UDID)}",
"ups": "${ENV(LIVEUPLIST)}",
}).
SetIOS(
uixt.WithUDID("$device"),
uixt.WithWDALogOn(true),
uixt.WithWDAPort(8100),
uixt.WithWDAMjpegPort(9100)),
TestSteps: []hrp.IStep{
hrp.NewStep("启动快手").
IOS().
AppTerminate("com.jiangjia.gif").
AppLaunch("com.jiangjia.gif").
Home().
SwipeToTapApp("快手", uixt.WithMaxRetryTimes(5)).Sleep(10).
Validate().
AssertOCRExists("精选", "进入快手失败"),
hrp.NewStep("点击首页").
IOS().
TapByOCR("首页", uixt.WithIndex(-1)).Sleep(10),
hrp.NewStep("点击发现页").
IOS().
TapByOCR("发现", uixt.WithIndex(1)).Sleep(10),
hrp.NewStep("点击关注页").
IOS().
TapByOCR("关注", uixt.WithIndex(1)).Sleep(10),
hrp.NewStep("点击直播标签,进入直播间").
IOS().
SwipeToTapTexts("${split_by_comma($ups)}", uixt.WithCustomDirection(0.6, 0.2, 0.2, 0.2), uixt.WithIdentifier("click_live")).Sleep(60).
Validate().
AssertOCRExists("说点什么", "进入直播间失败"),
hrp.NewStep("下滑进入下一个直播间").
IOS().
Swipe(0.9, 0.7, 0.9, 0.3, uixt.WithIdentifier("slide_in_live")).Sleep(60),
},
}
if err := testCase.Dump2JSON("ios_kuaishou_follow_live_test.json"); err != nil {
t.Fatal(err)
}
err := hrp.Run(t, testCase)
if err != nil {
t.Fatal(err)
}
}

View File

@@ -1,153 +0,0 @@
{
"config": {
"name": "直播_快手_关注天窗_ios",
"variables": {
"device": "${ENV(UDID)}",
"ups": "${ENV(LIVEUPLIST)}"
},
"ios": [
{
"udid": "$device",
"port": 8100,
"mjpeg_port": 9100,
"log_on": true
}
]
},
"teststeps": [
{
"name": "启动快手",
"ios": {
"actions": [
{
"method": "app_terminate",
"params": "com.jiangjia.gif"
},
{
"method": "app_launch",
"params": "com.jiangjia.gif"
},
{
"method": "home"
},
{
"method": "swipe_to_tap_app",
"params": "快手",
"max_retry_times": 5
},
{
"method": "sleep",
"params": 10
}
]
},
"validate": [
{
"check": "ui_ocr",
"assert": "exists",
"expect": "精选",
"msg": "进入快手失败"
}
]
},
{
"name": "点击首页",
"ios": {
"actions": [
{
"method": "tap_ocr",
"params": "首页",
"index": -1
},
{
"method": "sleep",
"params": 10
}
]
}
},
{
"name": "点击发现页",
"ios": {
"actions": [
{
"method": "tap_ocr",
"params": "发现",
"index": 1
},
{
"method": "sleep",
"params": 10
}
]
}
},
{
"name": "点击关注页",
"ios": {
"actions": [
{
"method": "tap_ocr",
"params": "关注",
"index": 1
},
{
"method": "sleep",
"params": 10
}
]
}
},
{
"name": "点击直播标签,进入直播间",
"ios": {
"actions": [
{
"method": "swipe_to_tap_texts",
"params": "${split_by_comma($ups)}",
"identifier": "click_live",
"direction": [
0.6,
0.2,
0.2,
0.2
]
},
{
"method": "sleep",
"params": 60
}
]
},
"validate": [
{
"check": "ui_ocr",
"assert": "exists",
"expect": "说点什么",
"msg": "进入直播间失败"
}
]
},
{
"name": "下滑进入下一个直播间",
"ios": {
"actions": [
{
"method": "swipe",
"params": [
0.9,
0.7,
0.9,
0.3
],
"identifier": "slide_in_live"
},
{
"method": "sleep",
"params": 60
}
]
}
}
]
}

View File

@@ -1 +1 @@
v4.3.4-beta-2306282100
v4.3.4

View File

@@ -28,7 +28,7 @@ func setupSpringBoardSrv(t *testing.T) {
func Test_springBoard_GetIcon(t *testing.T) {
setupSpringBoardSrv(t)
raw, _ := springBoardSrv.GetIconPNGData("com.tencent.xin")
raw, _ := springBoardSrv.GetIconPNGData("com.ss.iphone.ugc.Aweme")
img, format, err := image.Decode(raw)
if err != nil {
t.Fatal(err)

View File

@@ -212,12 +212,6 @@ func Test_remoteWD_Homescreen(t *testing.T) {
func Test_remoteWD_AppLaunch(t *testing.T) {
setup(t)
// bundleId = "com.hustlzp.xcz"
// bundleId = "com.github.stormbreaker.prod"
// bundleId = "com.360buy.jdmobile"
// bundleId = "com.zhihu.ios"
// bundleId = "com.tencent.xin"
// bundleId = "com.jsmcc.ZP7267A6ES"
err := driver.AppLaunch(bundleId)
// err := driver.AppLaunch(bundleId, NewAppLaunchOption().WithShouldWaitForQuiescence(true))
// err := driver.AppLaunch(bundleId, NewAppLaunchOption().WithArguments([]string{"-AppleLanguages", "(Russian)"}))

View File

@@ -68,36 +68,6 @@ func TestIOSAppLaunch(t *testing.T) {
}
}
func TestIOSWeixinLive(t *testing.T) {
testCase := &TestCase{
Config: NewConfig("ios ui action on 微信直播").
SetIOS(uixt.WithWDALogOn(true), uixt.WithWDAPort(8100), uixt.WithWDAMjpegPort(9100)),
TestSteps: []IStep{
NewStep("启动微信").
IOS().
Home().
AppTerminate("com.tencent.xin"). // 关闭已运行的微信,确保启动微信后在「微信」首页
Tap("微信").
Validate().
AssertLabelExists("通讯录", "微信启动失败,「通讯录」不存在"),
NewStep("进入直播页").
IOS().
Tap("发现").Sleep(5). // 进入「发现页」;等待 5 秒确保加载完成
TapByOCR("直播"). // 通过 OCR 识别「直播」
Validate().
AssertLabelExists("直播"),
NewStep("向上滑动 3 次,截图保存").
Loop(3). // 整体循环 3 次
IOS().
SwipeUp().SwipeUp().ScreenShot(), // 上划 2 次,截图保存
},
}
err := NewRunner(t).Run(testCase)
if err != nil {
t.Fatal(err)
}
}
func TestIOSCameraPhotoCapture(t *testing.T) {
testCase := &TestCase{
Config: NewConfig("ios camera photo capture"),