mirror of
https://github.com/httprunner/httprunner.git
synced 2026-07-12 16:01:27 +08:00
refactor: enhance JSON handling and improve request retry logic in DriverSession
This commit is contained in:
@@ -7,10 +7,11 @@ import (
|
||||
"reflect"
|
||||
"strings"
|
||||
|
||||
"github.com/httprunner/httprunner/v5/internal/builtin"
|
||||
"github.com/httprunner/httprunner/v5/uixt/types"
|
||||
"github.com/mark3labs/mcp-go/mcp"
|
||||
"github.com/rs/zerolog/log"
|
||||
|
||||
"github.com/httprunner/httprunner/v5/internal/builtin"
|
||||
"github.com/httprunner/httprunner/v5/uixt/types"
|
||||
)
|
||||
|
||||
type MobileAction struct {
|
||||
@@ -326,6 +327,10 @@ func (o *ActionOptions) Options() []ActionOption {
|
||||
options = append(options, WithAntiRisk(true))
|
||||
}
|
||||
|
||||
if o.PreMarkOperation {
|
||||
options = append(options, WithPreMarkOperation(true))
|
||||
}
|
||||
|
||||
// custom options
|
||||
if o.Custom != nil {
|
||||
for k, v := range o.Custom {
|
||||
|
||||
@@ -152,17 +152,6 @@ func WithDeviceWDAMjpegPort(port int) DeviceOption {
|
||||
}
|
||||
}
|
||||
|
||||
func WithDeviceLazySetup(lazySetup bool) DeviceOption {
|
||||
return func(device *DeviceOptions) {
|
||||
if device.IOSDeviceOptions != nil {
|
||||
device.IOSDeviceOptions.LazySetup = lazySetup
|
||||
}
|
||||
if device.Platform == "" {
|
||||
device.Platform = "ios"
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
func WithDeviceResetHomeOnStartup(reset bool) DeviceOption {
|
||||
return func(device *DeviceOptions) {
|
||||
if device.IOSDeviceOptions != nil {
|
||||
|
||||
@@ -6,7 +6,6 @@ type IOSDeviceOptions struct {
|
||||
WDAPort int `json:"port,omitempty" yaml:"port,omitempty"` // WDA remote port
|
||||
WDAMjpegPort int `json:"mjpeg_port,omitempty" yaml:"mjpeg_port,omitempty"` // WDA remote MJPEG port
|
||||
LogOn bool `json:"log_on,omitempty" yaml:"log_on,omitempty"`
|
||||
LazySetup bool `json:"lazy_setup,omitempty" yaml:"lazy_setup,omitempty"` // lazy setup WDA
|
||||
|
||||
// switch to iOS springboard before init WDA session
|
||||
ResetHomeOnStartup bool `json:"reset_home_on_startup,omitempty" yaml:"reset_home_on_startup,omitempty"`
|
||||
@@ -33,9 +32,6 @@ func (dev *IOSDeviceOptions) Options() (deviceOptions []IOSDeviceOption) {
|
||||
if dev.LogOn {
|
||||
deviceOptions = append(deviceOptions, WithWDALogOn(true))
|
||||
}
|
||||
if dev.LazySetup {
|
||||
deviceOptions = append(deviceOptions, WithLazySetup(true))
|
||||
}
|
||||
if dev.ResetHomeOnStartup {
|
||||
deviceOptions = append(deviceOptions, WithResetHomeOnStartup(true))
|
||||
}
|
||||
@@ -104,12 +100,6 @@ func WithWDALogOn(logOn bool) IOSDeviceOption {
|
||||
}
|
||||
}
|
||||
|
||||
func WithLazySetup(lazySetup bool) IOSDeviceOption {
|
||||
return func(device *IOSDeviceOptions) {
|
||||
device.LazySetup = lazySetup
|
||||
}
|
||||
}
|
||||
|
||||
func WithResetHomeOnStartup(reset bool) IOSDeviceOption {
|
||||
return func(device *IOSDeviceOptions) {
|
||||
device.ResetHomeOnStartup = reset
|
||||
|
||||
Reference in New Issue
Block a user