Files
httprunner/examples/uitest/android_expert_test.json
2024-08-27 20:38:46 +08:00

387 lines
12 KiB
JSON

{
"config": {
"name": "安卓专家用例",
"variables": {
"app_name": "抖音",
"bundle_id": "com.ss.android.ugc.aweme",
"device": "${ENV(SerialNumber)}",
"query": "${ENV(query)}"
},
"android": [
{
"serial": "$device",
"uia2": true,
"log_on": true
}
]
},
"teststeps": [
{
"name": "app_launch 以及 ui_foreground_app equal 断言",
"android": {
"actions": [
{
"method": "app_launch",
"params": "$bundle_id"
},
{
"method": "sleep",
"params": 2
}
]
},
"validate": [
{
"check": "ui_foreground_app",
"assert": "equal",
"expect": "$bundle_id",
"msg": "app [$bundle_id] should be in foreground"
}
]
},
{
"name": "home 以及 swipe_to_tap_app 默认配置",
"android": {
"actions": [
{
"method": "home"
},
{
"method": "swipe_to_tap_app",
"params": "$app_name",
"options": {}
},
{
"method": "sleep",
"params": 10
}
]
}
},
{
"name": "处理弹窗 close_popups 默认配置 以及 ui_ocr exists 断言",
"android": {
"actions": [
{
"method": "close_popups",
"options": {}
}
]
},
"validate": [
{
"check": "ui_ocr",
"assert": "exists",
"expect": "推荐",
"msg": "进入抖音失败"
}
]
},
{
"name": "【直播】feed头像或卡片进房 swipe_to_tap_texts 自定义配置",
"android": {
"actions": [
{
"method": "swipe_to_tap_texts",
"params": [
"直播",
"直播中",
"点击进入直播间"
],
"options": {
"identifier": "click_live",
"max_retry_times": 50,
"interval": 1.5,
"direction": [
0.5,
0.7,
0.5,
0.3
],
"scope": [
0.2,
0.2,
1,
0.8
]
}
}
]
}
},
{
"name": "sleep 10s",
"android": {
"actions": [
{
"method": "sleep",
"params": 10
}
]
}
},
{
"name": "【直播】swipe 自定义配置 以及 back",
"android": {
"actions": [
{
"method": "swipe",
"params": [
0.5,
0.7,
0.5,
0.3
],
"options": {
"identifier": "slide_in_live"
}
},
{
"method": "sleep",
"params": 5
},
{
"method": "back",
"options": {}
},
{
"method": "sleep",
"params": 5
}
]
}
},
{
"name": "【搜索】点击放大镜 tap_xy 自定义配置",
"android": {
"actions": [
{
"method": "tap_xy",
"params": [
0.9,
0.08
],
"options": {
"identifier": "click_search_in_middle_page"
}
},
{
"method": "sleep",
"params": 5
}
]
}
},
{
"name": "【搜索】输入query词 input",
"android": {
"actions": [
{
"method": "input",
"params": "$query",
"options": {
"identifier": "input_query"
}
},
{
"method": "sleep",
"params": 5
}
]
}
},
{
"name": "【搜索】点击搜索按钮 tap_ocr 自定义配置",
"android": {
"actions": [
{
"method": "tap_ocr",
"params": "搜索",
"options": {
"identifier": "click_search_after_input_query"
}
},
{
"method": "sleep",
"params": 5
}
]
}
},
{
"name": "选择直播页签 tap_ocr 默认配置",
"android": {
"actions": [
{
"method": "tap_ocr",
"params": "直播",
"options": {}
},
{
"method": "sleep",
"params": 5
}
]
}
},
{
"name": "【生活服务】进入直播间 tap_xy",
"android": {
"actions": [
{
"method": "tap_xy",
"params": [
0.5,
0.5
],
"options": {}
},
{
"method": "sleep",
"params": 5
}
]
}
},
{
"name": "【生活服务】点击货架商品 tap_ocr 自定义配置",
"android": {
"actions": [
{
"method": "tap_cv",
"options": {
"identifier": "click_sales_rack",
"screenshot_with_ui_types": [
"dyhouse",
"shoppingbag"
]
}
},
{
"method": "sleep",
"params": 5
}
]
}
},
{
"name": "app_terminate 以及 ui_foreground_app not_equal 断言",
"android": {
"actions": [
{
"method": "app_terminate",
"params": "$bundle_id"
},
{
"method": "sleep",
"params": 2
}
]
},
"validate": [
{
"check": "ui_foreground_app",
"assert": "not_equal",
"expect": "$bundle_id",
"msg": "app [$bundle_id] should not be in foreground"
}
]
},
{
"name": "home 以及 swipe_to_tap_app 自定义配置",
"android": {
"actions": [
{
"method": "home"
},
{
"method": "swipe_to_tap_app",
"params": "$app_name",
"options": {
"max_retry_times": 5,
"interval": 1,
"offset": [
0,
-50
]
}
},
{
"method": "sleep",
"params": 10
}
]
}
},
{
"name": "处理弹窗 close_popups 自定义配置 以及 ui_ocr exists 断言",
"android": {
"actions": [
{
"method": "close_popups",
"options": {
"max_retry_times": 3,
"interval": 2
}
}
]
},
"validate": [
{
"check": "ui_ocr",
"assert": "exists",
"expect": "推荐",
"msg": "进入抖音失败"
}
]
},
{
"name": "返回主界面,并打开本地时间戳",
"android": {
"actions": [
{
"method": "home"
},
{
"method": "app_terminate",
"params": "$bundle_id"
},
{
"method": "sleep",
"params": 3
},
{
"method": "swipe_to_tap_app",
"params": "local",
"options": {
"max_retry_times": 5
}
},
{
"method": "sleep",
"params": 10
}
]
}
},
{
"name": "screeshot 以及 sleep_random",
"android": {
"actions": [
{
"method": "screenshot",
"options": {}
},
{
"method": "sleep_random",
"params": [
1,
3
]
}
]
},
"loops": 3
}
]
}