change: add ks

This commit is contained in:
lilong.129
2023-05-10 16:23:47 +08:00
parent 41e4d89c95
commit 56e065c10b
6 changed files with 164 additions and 8 deletions

View File

@@ -18,7 +18,7 @@
{
"method": "video_crawler",
"params": {
"app_package_name": "com.ss.android.ugc.aweme",
"app_package_name": "com.smile.gifmaker",
"feed": {
"sleep_random": [
0,
@@ -38,7 +38,7 @@
1,
1
],
"target": 1,
"target": 0,
"text": "^广告$"
},
{
@@ -49,7 +49,7 @@
1,
1
],
"target": 1,
"target": 0,
"text": "^图文$"
},
{
@@ -89,7 +89,7 @@
15,
20
],
"target_count": 3
"target_count": 0
},
"timeout": 600
}

View File

@@ -56,3 +56,49 @@ 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)
}
runner := hrp.NewRunner(t).SetSaveTests(true)
err := runner.Run(testCase)
if err != nil {
t.Fatal(err)
}
}

View File

@@ -0,0 +1,98 @@
{
"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"
}
]
}
]
}