mirror of
https://github.com/httprunner/httprunner.git
synced 2026-09-07 00:17:37 +08:00
change: update tests
This commit is contained in:
@@ -8,8 +8,7 @@
|
|||||||
{
|
{
|
||||||
"port": 8700,
|
"port": 8700,
|
||||||
"mjpeg_port": 8800,
|
"mjpeg_port": 8800,
|
||||||
"log_on": true,
|
"log_on": true
|
||||||
"xctest_bundle_id": "com.gtf.wda.runner.xctrunner"
|
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
@@ -17,6 +16,7 @@
|
|||||||
{
|
{
|
||||||
"name": "启动抖音",
|
"name": "启动抖音",
|
||||||
"ios": {
|
"ios": {
|
||||||
|
"os_type": "ios",
|
||||||
"actions": [
|
"actions": [
|
||||||
{
|
{
|
||||||
"method": "home"
|
"method": "home"
|
||||||
@@ -28,8 +28,10 @@
|
|||||||
{
|
{
|
||||||
"method": "swipe_to_tap_app",
|
"method": "swipe_to_tap_app",
|
||||||
"params": "$app_name",
|
"params": "$app_name",
|
||||||
"identifier": "启动抖音",
|
"options": {
|
||||||
"max_retry_times": 5
|
"identifier": "启动抖音",
|
||||||
|
"max_retry_times": 5
|
||||||
|
}
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"method": "sleep",
|
"method": "sleep",
|
||||||
@@ -49,11 +51,14 @@
|
|||||||
{
|
{
|
||||||
"name": "处理青少年弹窗",
|
"name": "处理青少年弹窗",
|
||||||
"ios": {
|
"ios": {
|
||||||
|
"os_type": "ios",
|
||||||
"actions": [
|
"actions": [
|
||||||
{
|
{
|
||||||
"method": "tap_ocr",
|
"method": "tap_ocr",
|
||||||
"params": "我知道了",
|
"params": "我知道了",
|
||||||
"ignore_NotFoundError": true
|
"options": {
|
||||||
|
"ignore_NotFoundError": true
|
||||||
|
}
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
@@ -61,11 +66,14 @@
|
|||||||
{
|
{
|
||||||
"name": "进入购物页",
|
"name": "进入购物页",
|
||||||
"ios": {
|
"ios": {
|
||||||
|
"os_type": "ios",
|
||||||
"actions": [
|
"actions": [
|
||||||
{
|
{
|
||||||
"method": "tap_ocr",
|
"method": "tap_ocr",
|
||||||
"params": "商城",
|
"params": "商城",
|
||||||
"identifier": "点击商城"
|
"options": {
|
||||||
|
"identifier": "点击商城"
|
||||||
|
}
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"method": "sleep",
|
"method": "sleep",
|
||||||
@@ -77,11 +85,14 @@
|
|||||||
{
|
{
|
||||||
"name": "进入推荐页",
|
"name": "进入推荐页",
|
||||||
"ios": {
|
"ios": {
|
||||||
|
"os_type": "ios",
|
||||||
"actions": [
|
"actions": [
|
||||||
{
|
{
|
||||||
"method": "tap_ocr",
|
"method": "tap_ocr",
|
||||||
"params": "推荐",
|
"params": "推荐",
|
||||||
"identifier": "点击推荐"
|
"options": {
|
||||||
|
"identifier": "点击推荐"
|
||||||
|
}
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"method": "sleep",
|
"method": "sleep",
|
||||||
@@ -93,29 +104,36 @@
|
|||||||
{
|
{
|
||||||
"name": "向上滑动 2 次",
|
"name": "向上滑动 2 次",
|
||||||
"ios": {
|
"ios": {
|
||||||
|
"os_type": "ios",
|
||||||
"actions": [
|
"actions": [
|
||||||
{
|
{
|
||||||
"method": "swipe",
|
"method": "swipe_direction",
|
||||||
"params": "up",
|
"params": "up",
|
||||||
"identifier": "第 1 次上划"
|
"options": {
|
||||||
|
"identifier": "第 1 次上划"
|
||||||
|
}
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"method": "sleep",
|
"method": "sleep",
|
||||||
"params": 2
|
"params": 2
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"method": "swipe",
|
"method": "swipe_direction",
|
||||||
"params": "up",
|
"params": "up",
|
||||||
"identifier": "第 2 次上划"
|
"options": {
|
||||||
|
"identifier": "第 2 次上划"
|
||||||
|
}
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"method": "sleep",
|
"method": "sleep",
|
||||||
"params": 2
|
"params": 2
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"method": "swipe",
|
"method": "swipe_direction",
|
||||||
"params": "up",
|
"params": "up",
|
||||||
"identifier": "第 3 次上划"
|
"options": {
|
||||||
|
"identifier": "第 3 次上划"
|
||||||
|
}
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"method": "sleep",
|
"method": "sleep",
|
||||||
@@ -127,7 +145,9 @@
|
|||||||
0.9,
|
0.9,
|
||||||
0.1
|
0.1
|
||||||
],
|
],
|
||||||
"identifier": "点击进入搜索框"
|
"options": {
|
||||||
|
"identifier": "点击进入搜索框"
|
||||||
|
}
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"method": "sleep",
|
"method": "sleep",
|
||||||
@@ -135,8 +155,17 @@
|
|||||||
},
|
},
|
||||||
{
|
{
|
||||||
"method": "input",
|
"method": "input",
|
||||||
"params": "httprunner",
|
"params": "httprunner 发版记录",
|
||||||
"identifier": "输入搜索关键词"
|
"options": {
|
||||||
|
"identifier": "输入搜索关键词"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"method": "tap_ocr",
|
||||||
|
"params": "搜索",
|
||||||
|
"options": {
|
||||||
|
"identifier": "点击搜索"
|
||||||
|
}
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -43,7 +43,8 @@ func TestWDALog(t *testing.T) {
|
|||||||
SwipeUp(option.WithIdentifier("第 2 次上划")).Sleep(2).
|
SwipeUp(option.WithIdentifier("第 2 次上划")).Sleep(2).
|
||||||
SwipeUp(option.WithIdentifier("第 3 次上划")).Sleep(2).
|
SwipeUp(option.WithIdentifier("第 3 次上划")).Sleep(2).
|
||||||
TapXY(0.9, 0.1, option.WithIdentifier("点击进入搜索框")).Sleep(2).
|
TapXY(0.9, 0.1, option.WithIdentifier("点击进入搜索框")).Sleep(2).
|
||||||
Input("httprunner", option.WithIdentifier("输入搜索关键词")),
|
Input("httprunner 发版记录", option.WithIdentifier("输入搜索关键词")).
|
||||||
|
TapByOCR("搜索", option.WithIdentifier("点击搜索")),
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -1 +1 @@
|
|||||||
v5.0.0-beta-2506261907
|
v5.0.0-beta-2506261939
|
||||||
|
|||||||
@@ -164,6 +164,9 @@ func (dev *IOSDevice) Setup() error {
|
|||||||
dev.DeviceEntry.UserspaceTUNPort = info.UserspaceTUNPort
|
dev.DeviceEntry.UserspaceTUNPort = info.UserspaceTUNPort
|
||||||
dev.DeviceEntry.UserspaceTUN = info.UserspaceTUN
|
dev.DeviceEntry.UserspaceTUN = info.UserspaceTUN
|
||||||
rsdService, err := ios.NewWithAddrPortDevice(info.Address, info.RsdPort, dev.DeviceEntry)
|
rsdService, err := ios.NewWithAddrPortDevice(info.Address, info.RsdPort, dev.DeviceEntry)
|
||||||
|
if err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
defer rsdService.Close()
|
defer rsdService.Close()
|
||||||
rsdProvider, err := rsdService.Handshake()
|
rsdProvider, err := rsdService.Handshake()
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
|||||||
@@ -56,21 +56,6 @@ const (
|
|||||||
defaultMjpegPort = 9100
|
defaultMjpegPort = 9100
|
||||||
)
|
)
|
||||||
|
|
||||||
const (
|
|
||||||
// Changes the value of maximum depth for traversing elements source tree.
|
|
||||||
// It may help to prevent out of memory or timeout errors while getting the elements source tree,
|
|
||||||
// but it might restrict the depth of source tree.
|
|
||||||
// A part of elements source tree might be lost if the value was too small. Defaults to 50
|
|
||||||
defaultSnapshotMaxDepth = 10
|
|
||||||
// Allows to customize accept/dismiss alert button selector.
|
|
||||||
// It helps you to handle an arbitrary element as accept button in accept alert command.
|
|
||||||
// The selector should be a valid class chain expression, where the search root is the alert element itself.
|
|
||||||
// The default button location algorithm is used if the provided selector is wrong or does not match any element.
|
|
||||||
// e.g. **/XCUIElementTypeButton[`label CONTAINS[c] 'accept'`]
|
|
||||||
acceptAlertButtonSelector = "**/XCUIElementTypeButton[`label IN {'允许','好','仅在使用应用期间','稍后再说'}`]"
|
|
||||||
dismissAlertButtonSelector = "**/XCUIElementTypeButton[`label IN {'不允许','暂不'}`]"
|
|
||||||
)
|
|
||||||
|
|
||||||
func NewIOSDeviceOptions(opts ...IOSDeviceOption) *IOSDeviceOptions {
|
func NewIOSDeviceOptions(opts ...IOSDeviceOption) *IOSDeviceOptions {
|
||||||
config := &IOSDeviceOptions{}
|
config := &IOSDeviceOptions{}
|
||||||
for _, opt := range opts {
|
for _, opt := range opts {
|
||||||
@@ -84,16 +69,6 @@ func NewIOSDeviceOptions(opts ...IOSDeviceOption) *IOSDeviceOptions {
|
|||||||
config.WDAMjpegPort = defaultMjpegPort
|
config.WDAMjpegPort = defaultMjpegPort
|
||||||
}
|
}
|
||||||
|
|
||||||
if config.SnapshotMaxDepth == 0 {
|
|
||||||
config.SnapshotMaxDepth = defaultSnapshotMaxDepth
|
|
||||||
}
|
|
||||||
if config.AcceptAlertButtonSelector == "" {
|
|
||||||
config.AcceptAlertButtonSelector = acceptAlertButtonSelector
|
|
||||||
}
|
|
||||||
if config.DismissAlertButtonSelector == "" {
|
|
||||||
config.DismissAlertButtonSelector = dismissAlertButtonSelector
|
|
||||||
}
|
|
||||||
|
|
||||||
return config
|
return config
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user