mirror of
https://github.com/httprunner/httprunner.git
synced 2026-06-03 14:59:38 +08:00
refactor: remove video crawler
This commit is contained in:
@@ -335,92 +335,6 @@
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"name": "【点播】滑动消费",
|
||||
"android": {
|
||||
"actions": [
|
||||
{
|
||||
"method": "video_crawler",
|
||||
"params": {
|
||||
"feed": {
|
||||
"sleep_random": [
|
||||
0,
|
||||
5,
|
||||
0.6,
|
||||
5,
|
||||
15,
|
||||
0.2,
|
||||
15,
|
||||
50,
|
||||
0.2
|
||||
],
|
||||
"target_count": 10,
|
||||
"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": "^特效\\|"
|
||||
},
|
||||
{
|
||||
"regex": true,
|
||||
"scope": [
|
||||
0,
|
||||
0.5,
|
||||
1,
|
||||
1
|
||||
],
|
||||
"text": "^模板\\|"
|
||||
},
|
||||
{
|
||||
"regex": true,
|
||||
"scope": [
|
||||
0,
|
||||
0.5,
|
||||
1,
|
||||
1
|
||||
],
|
||||
"text": "^购物\\|"
|
||||
}
|
||||
]
|
||||
},
|
||||
"live": {
|
||||
"sleep_random": [
|
||||
20,
|
||||
20
|
||||
],
|
||||
"target_count": 0
|
||||
},
|
||||
"timeout": 600
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
||||
},
|
||||
{
|
||||
"name": "返回主界面,并打开本地时间戳",
|
||||
"android": {
|
||||
|
||||
@@ -1,142 +0,0 @@
|
||||
{
|
||||
"config": {
|
||||
"name": "抓取抖音视频信息",
|
||||
"variables": {
|
||||
"device": "${ENV(SerialNumber)}"
|
||||
},
|
||||
"android": [
|
||||
{
|
||||
"serial": "$device"
|
||||
}
|
||||
]
|
||||
},
|
||||
"teststeps": [
|
||||
{
|
||||
"name": "启动 app",
|
||||
"android": {
|
||||
"actions": [
|
||||
{
|
||||
"method": "app_launch",
|
||||
"params": "com.ss.android.ugc.aweme"
|
||||
},
|
||||
{
|
||||
"method": "sleep",
|
||||
"params": 5
|
||||
}
|
||||
]
|
||||
},
|
||||
"validate": [
|
||||
{
|
||||
"check": "ui_foreground_app",
|
||||
"assert": "equal",
|
||||
"expect": "com.ss.android.ugc.aweme",
|
||||
"msg": "app [com.ss.android.ugc.aweme] should be in foreground"
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"name": "滑动消费 feed 至少 10 个,live 至少 3 个;滑动过程中,70% 随机间隔 0-5s,30% 随机间隔 5-10s",
|
||||
"android": {
|
||||
"actions": [
|
||||
{
|
||||
"method": "video_crawler",
|
||||
"params": {
|
||||
"feed": {
|
||||
"sleep_random": [
|
||||
0,
|
||||
5,
|
||||
0.7,
|
||||
5,
|
||||
10,
|
||||
0.3
|
||||
],
|
||||
"target_count": 5,
|
||||
"target_labels": [
|
||||
{
|
||||
"regex": true,
|
||||
"scope": [
|
||||
0,
|
||||
0.5,
|
||||
1,
|
||||
1
|
||||
],
|
||||
"target": 1,
|
||||
"text": "^广告$"
|
||||
},
|
||||
{
|
||||
"regex": true,
|
||||
"scope": [
|
||||
0,
|
||||
0.5,
|
||||
1,
|
||||
1
|
||||
],
|
||||
"target": 1,
|
||||
"text": "^图文$"
|
||||
},
|
||||
{
|
||||
"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": 3
|
||||
},
|
||||
"timeout": 600
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
||||
},
|
||||
{
|
||||
"name": "exit",
|
||||
"android": {
|
||||
"actions": [
|
||||
{
|
||||
"method": "app_terminate",
|
||||
"params": "com.ss.android.ugc.aweme"
|
||||
}
|
||||
]
|
||||
},
|
||||
"validate": [
|
||||
{
|
||||
"check": "ui_foreground_app",
|
||||
"assert": "not_equal",
|
||||
"expect": "com.ss.android.ugc.aweme",
|
||||
"msg": "app [com.ss.android.ugc.aweme] should not be in foreground"
|
||||
}
|
||||
]
|
||||
}
|
||||
]
|
||||
}
|
||||
@@ -1,63 +0,0 @@
|
||||
//go:build localtest
|
||||
|
||||
package uitest
|
||||
|
||||
import (
|
||||
"testing"
|
||||
|
||||
"github.com/httprunner/httprunner/v4/hrp"
|
||||
"github.com/httprunner/httprunner/v4/hrp/pkg/uixt"
|
||||
)
|
||||
|
||||
func TestAndroidVideoCrawlerTest(t *testing.T) {
|
||||
testCase := &hrp.TestCase{
|
||||
Config: hrp.NewConfig("抓取抖音视频信息").
|
||||
WithVariables(map[string]interface{}{
|
||||
"device": "${ENV(SerialNumber)}",
|
||||
}).
|
||||
SetAndroid(uixt.WithSerialNumber("$device")),
|
||||
TestSteps: []hrp.IStep{
|
||||
hrp.NewStep("启动 app").
|
||||
Android().
|
||||
ScreenShot(uixt.WithScreenShotOCR(true), uixt.WithScreenShotUpload(true)).
|
||||
AppLaunch("com.ss.android.ugc.aweme").
|
||||
Sleep(5).
|
||||
Validate().
|
||||
AssertAppInForeground("com.ss.android.ugc.aweme"),
|
||||
hrp.NewStep("滑动消费 feed 至少 10 个,live 至少 3 个;滑动过程中,70% 随机间隔 0-5s,30% 随机间隔 5-10s").
|
||||
Android().
|
||||
VideoCrawler(map[string]interface{}{
|
||||
"timeout": 600,
|
||||
"feed": map[string]interface{}{
|
||||
"target_count": 5,
|
||||
"target_labels": []map[string]interface{}{
|
||||
{"text": "^广告$", "scope": []float64{0, 0.5, 1, 1}, "regex": true, "target": 1},
|
||||
{"text": "^图文$", "scope": []float64{0, 0.5, 1, 1}, "regex": true, "target": 1},
|
||||
{"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": 3,
|
||||
"sleep_random": []float64{15, 20},
|
||||
},
|
||||
}),
|
||||
hrp.NewStep("exit").
|
||||
Android().
|
||||
AppTerminate("com.ss.android.ugc.aweme").
|
||||
Validate().
|
||||
AssertAppNotInForeground("com.ss.android.ugc.aweme"),
|
||||
},
|
||||
}
|
||||
|
||||
if err := testCase.Dump2JSON("demo_android_video_crawler.json"); err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
|
||||
err := hrp.Run(t, testCase)
|
||||
if err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
}
|
||||
@@ -121,27 +121,6 @@ func TestAndroidExpertTest(t *testing.T) {
|
||||
).
|
||||
Validate().
|
||||
AssertOCRExists("推荐", "进入抖音失败"),
|
||||
// 点播赛道
|
||||
hrp.NewStep("【点播】滑动消费").
|
||||
Android().
|
||||
VideoCrawler(map[string]interface{}{
|
||||
"timeout": 600,
|
||||
"feed": map[string]interface{}{
|
||||
"target_count": 10,
|
||||
"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},
|
||||
{"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.6, 5, 15, 0.2, 15, 50, 0.2},
|
||||
},
|
||||
"live": map[string]interface{}{
|
||||
"target_count": 0,
|
||||
"sleep_random": []float64{20, 20},
|
||||
},
|
||||
}),
|
||||
// localtime 时间戳界面
|
||||
hrp.NewStep("返回主界面,并打开本地时间戳").
|
||||
Android().
|
||||
@@ -275,27 +254,6 @@ func TestIOSExpertTest(t *testing.T) {
|
||||
).
|
||||
Validate().
|
||||
AssertOCRExists("推荐", "进入抖音失败"),
|
||||
// 点播赛道
|
||||
hrp.NewStep("【点播】滑动消费").
|
||||
IOS().
|
||||
VideoCrawler(map[string]interface{}{
|
||||
"timeout": 600,
|
||||
"feed": map[string]interface{}{
|
||||
"target_count": 10,
|
||||
"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},
|
||||
{"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.6, 5, 15, 0.2, 15, 50, 0.2},
|
||||
},
|
||||
"live": map[string]interface{}{
|
||||
"target_count": 0,
|
||||
"sleep_random": []float64{20, 20},
|
||||
},
|
||||
}),
|
||||
// localtime 时间戳界面
|
||||
hrp.NewStep("返回主界面,并打开本地时间戳").
|
||||
IOS().
|
||||
|
||||
@@ -320,92 +320,6 @@
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"name": "【点播】滑动消费",
|
||||
"ios": {
|
||||
"actions": [
|
||||
{
|
||||
"method": "video_crawler",
|
||||
"params": {
|
||||
"feed": {
|
||||
"sleep_random": [
|
||||
0,
|
||||
5,
|
||||
0.6,
|
||||
5,
|
||||
15,
|
||||
0.2,
|
||||
15,
|
||||
50,
|
||||
0.2
|
||||
],
|
||||
"target_count": 10,
|
||||
"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": "^特效\\|"
|
||||
},
|
||||
{
|
||||
"regex": true,
|
||||
"scope": [
|
||||
0,
|
||||
0.5,
|
||||
1,
|
||||
1
|
||||
],
|
||||
"text": "^模板\\|"
|
||||
},
|
||||
{
|
||||
"regex": true,
|
||||
"scope": [
|
||||
0,
|
||||
0.5,
|
||||
1,
|
||||
1
|
||||
],
|
||||
"text": "^购物\\|"
|
||||
}
|
||||
]
|
||||
},
|
||||
"live": {
|
||||
"sleep_random": [
|
||||
20,
|
||||
20
|
||||
],
|
||||
"target_count": 0
|
||||
},
|
||||
"timeout": 600
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
||||
},
|
||||
{
|
||||
"name": "返回主界面,并打开本地时间戳",
|
||||
"ios": {
|
||||
|
||||
Reference in New Issue
Block a user