mirror of
https://github.com/httprunner/httprunner.git
synced 2026-09-09 01:17:30 +08:00
feat: DisableAutoPopupHandler
This commit is contained in:
@@ -41,6 +41,7 @@ type TConfig struct {
|
|||||||
Weight int `json:"weight,omitempty" yaml:"weight,omitempty"`
|
Weight int `json:"weight,omitempty" yaml:"weight,omitempty"`
|
||||||
Path string `json:"path,omitempty" yaml:"path,omitempty"` // testcase file path
|
Path string `json:"path,omitempty" yaml:"path,omitempty"` // testcase file path
|
||||||
PluginSetting *PluginConfig `json:"plugin,omitempty" yaml:"plugin,omitempty"` // plugin config
|
PluginSetting *PluginConfig `json:"plugin,omitempty" yaml:"plugin,omitempty"` // plugin config
|
||||||
|
IgnorePopup bool `json:"ignore_popup,omitempty" yaml:"ignore_popup,omitempty"`
|
||||||
}
|
}
|
||||||
|
|
||||||
func (c *TConfig) Get() *TConfig {
|
func (c *TConfig) Get() *TConfig {
|
||||||
@@ -179,6 +180,11 @@ func (c *TConfig) SetAndroid(options ...uixt.AndroidDeviceOption) *TConfig {
|
|||||||
return c
|
return c
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func (s *TConfig) DisableAutoPopupHandler() *TConfig {
|
||||||
|
s.IgnorePopup = true
|
||||||
|
return s
|
||||||
|
}
|
||||||
|
|
||||||
type ThinkTimeConfig struct {
|
type ThinkTimeConfig struct {
|
||||||
Strategy thinkTimeStrategy `json:"strategy,omitempty" yaml:"strategy,omitempty"` // default、random、multiply、ignore
|
Strategy thinkTimeStrategy `json:"strategy,omitempty" yaml:"strategy,omitempty"` // default、random、multiply、ignore
|
||||||
Setting interface{} `json:"setting,omitempty" yaml:"setting,omitempty"` // random(map): {"min_percentage": 0.5, "max_percentage": 1.5}; 10、multiply(float64): 1.5
|
Setting interface{} `json:"setting,omitempty" yaml:"setting,omitempty"` // random(map): {"min_percentage": 0.5, "max_percentage": 1.5}; 10、multiply(float64): 1.5
|
||||||
|
|||||||
@@ -1 +1 @@
|
|||||||
v5.0.0+2411132151
|
v5.0.0+2411141441
|
||||||
|
|||||||
@@ -169,7 +169,6 @@ type AndroidDevice struct {
|
|||||||
UIA2IP string `json:"uia2_ip,omitempty" yaml:"uia2_ip,omitempty"` // uiautomator2 server ip
|
UIA2IP string `json:"uia2_ip,omitempty" yaml:"uia2_ip,omitempty"` // uiautomator2 server ip
|
||||||
UIA2Port int `json:"uia2_port,omitempty" yaml:"uia2_port,omitempty"` // uiautomator2 server port
|
UIA2Port int `json:"uia2_port,omitempty" yaml:"uia2_port,omitempty"` // uiautomator2 server port
|
||||||
LogOn bool `json:"log_on,omitempty" yaml:"log_on,omitempty"`
|
LogOn bool `json:"log_on,omitempty" yaml:"log_on,omitempty"`
|
||||||
IgnorePopup bool `json:"ignore_popup,omitempty" yaml:"ignore_popup,omitempty"`
|
|
||||||
}
|
}
|
||||||
|
|
||||||
func (dev *AndroidDevice) Options() (deviceOptions []AndroidDeviceOption) {
|
func (dev *AndroidDevice) Options() (deviceOptions []AndroidDeviceOption) {
|
||||||
|
|||||||
@@ -18,7 +18,6 @@ var (
|
|||||||
type HarmonyDevice struct {
|
type HarmonyDevice struct {
|
||||||
d *ghdc.Device
|
d *ghdc.Device
|
||||||
ConnectKey string `json:"connect_key,omitempty" yaml:"connect_key,omitempty"`
|
ConnectKey string `json:"connect_key,omitempty" yaml:"connect_key,omitempty"`
|
||||||
IgnorePopup bool `json:"ignore_popup,omitempty" yaml:"ignore_popup,omitempty"`
|
|
||||||
LogOn bool `json:"log_on,omitempty" yaml:"log_on,omitempty"`
|
LogOn bool `json:"log_on,omitempty" yaml:"log_on,omitempty"`
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -26,9 +25,6 @@ func (dev *HarmonyDevice) Options() (deviceOptions []HarmonyDeviceOption) {
|
|||||||
if dev.ConnectKey != "" {
|
if dev.ConnectKey != "" {
|
||||||
deviceOptions = append(deviceOptions, WithConnectKey(dev.ConnectKey))
|
deviceOptions = append(deviceOptions, WithConnectKey(dev.ConnectKey))
|
||||||
}
|
}
|
||||||
if dev.IgnorePopup {
|
|
||||||
deviceOptions = append(deviceOptions, WithIgnorePopup(true))
|
|
||||||
}
|
|
||||||
if dev.LogOn {
|
if dev.LogOn {
|
||||||
deviceOptions = append(deviceOptions, WithLogOn(true))
|
deviceOptions = append(deviceOptions, WithLogOn(true))
|
||||||
}
|
}
|
||||||
@@ -43,12 +39,6 @@ func WithConnectKey(connectKey string) HarmonyDeviceOption {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
func WithIgnorePopup(ignorePopup bool) HarmonyDeviceOption {
|
|
||||||
return func(device *HarmonyDevice) {
|
|
||||||
device.IgnorePopup = ignorePopup
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
func WithLogOn(logOn bool) HarmonyDeviceOption {
|
func WithLogOn(logOn bool) HarmonyDeviceOption {
|
||||||
return func(device *HarmonyDevice) {
|
return func(device *HarmonyDevice) {
|
||||||
device.LogOn = logOn
|
device.LogOn = logOn
|
||||||
|
|||||||
@@ -240,7 +240,6 @@ type IOSDevice struct {
|
|||||||
MjpegPort int `json:"mjpeg_port,omitempty" yaml:"mjpeg_port,omitempty"` // WDA remote MJPEG port
|
MjpegPort int `json:"mjpeg_port,omitempty" yaml:"mjpeg_port,omitempty"` // WDA remote MJPEG port
|
||||||
LogOn bool `json:"log_on,omitempty" yaml:"log_on,omitempty"`
|
LogOn bool `json:"log_on,omitempty" yaml:"log_on,omitempty"`
|
||||||
XCTestBundleID string `json:"xctest_bundle_id,omitempty" yaml:"xctest_bundle_id,omitempty"`
|
XCTestBundleID string `json:"xctest_bundle_id,omitempty" yaml:"xctest_bundle_id,omitempty"`
|
||||||
IgnorePopup bool `json:"ignore_popup,omitempty" yaml:"ignore_popup,omitempty"`
|
|
||||||
|
|
||||||
// switch to iOS springboard before init WDA session
|
// switch to iOS springboard before init WDA session
|
||||||
ResetHomeOnStartup bool `json:"reset_home_on_startup,omitempty" yaml:"reset_home_on_startup,omitempty"`
|
ResetHomeOnStartup bool `json:"reset_home_on_startup,omitempty" yaml:"reset_home_on_startup,omitempty"`
|
||||||
|
|||||||
@@ -392,6 +392,11 @@ func (s *StepMobile) StopCamera() *StepMobile {
|
|||||||
return s
|
return s
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func (s *StepMobile) DisableAutoPopupHandler() *StepMobile {
|
||||||
|
s.IgnorePopup = true
|
||||||
|
return s
|
||||||
|
}
|
||||||
|
|
||||||
func (s *StepMobile) ClosePopups(options ...uixt.ActionOption) *StepMobile {
|
func (s *StepMobile) ClosePopups(options ...uixt.ActionOption) *StepMobile {
|
||||||
s.obj().Actions = append(s.obj().Actions, uixt.MobileAction{
|
s.obj().Actions = append(s.obj().Actions, uixt.MobileAction{
|
||||||
Method: uixt.ACTION_ClosePopups,
|
Method: uixt.ACTION_ClosePopups,
|
||||||
@@ -669,7 +674,7 @@ func runStepMobileUI(s *SessionRunner, step IStep) (stepResult *StepResult, err
|
|||||||
}
|
}
|
||||||
|
|
||||||
// automatic handling of pop-up windows on each step finished
|
// automatic handling of pop-up windows on each step finished
|
||||||
if !ignorePopup && !s.IgnorePopup() {
|
if !ignorePopup && !s.caseRunner.Config.Get().IgnorePopup {
|
||||||
if err2 := uiDriver.ClosePopupsHandler(); err2 != nil {
|
if err2 := uiDriver.ClosePopupsHandler(); err2 != nil {
|
||||||
log.Error().Err(err2).Str("step", step.Name()).Msg("auto handle popup failed")
|
log.Error().Err(err2).Str("step", step.Name()).Msg("auto handle popup failed")
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user