mirror of
https://github.com/httprunner/httprunner.git
synced 2026-06-09 17:59:36 +08:00
feat: 兼容iproxy 2.1.0 新增步骤弹窗忽略和全局弹窗忽略
This commit is contained in:
@@ -154,6 +154,7 @@ type AndroidDevice struct {
|
||||
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
|
||||
LogOn bool `json:"log_on,omitempty" yaml:"log_on,omitempty"`
|
||||
IgnorePopup bool `json:"ignore_popup,omitempty" yaml:"ignore_popup,omitempty"`
|
||||
}
|
||||
|
||||
func (dev *AndroidDevice) UUID() string {
|
||||
|
||||
@@ -276,6 +276,7 @@ type IOSDevice struct {
|
||||
MjpegPort int `json:"mjpeg_port,omitempty" yaml:"mjpeg_port,omitempty"` // WDA remote MJPEG port
|
||||
LogOn bool `json:"log_on,omitempty" yaml:"log_on,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
|
||||
ResetHomeOnStartup bool `json:"reset_home_on_startup,omitempty" yaml:"reset_home_on_startup,omitempty"`
|
||||
@@ -631,7 +632,7 @@ func (dev *IOSDevice) NewHTTPDriver(capabilities Capabilities) (driver WebDriver
|
||||
wd := new(wdaDriver)
|
||||
wd.client = http.DefaultClient
|
||||
|
||||
host := "127.0.0.1"
|
||||
host := "localhost"
|
||||
if wd.urlPrefix, err = url.Parse(fmt.Sprintf("http://%s:%d", host, localPort)); err != nil {
|
||||
return nil, errors.Wrap(code.IOSDeviceHTTPDriverError, err.Error())
|
||||
}
|
||||
|
||||
@@ -711,6 +711,16 @@ func (r *SessionRunner) GetSummary() (*TestCaseSummary, error) {
|
||||
return caseSummary, nil
|
||||
}
|
||||
|
||||
func (r *SessionRunner) IgnorePopup() bool {
|
||||
if r.caseRunner.testCase.Config.Android != nil {
|
||||
return r.caseRunner.testCase.Config.Android[0].IgnorePopup
|
||||
}
|
||||
if r.caseRunner.testCase.Config.IOS != nil {
|
||||
return r.caseRunner.testCase.Config.IOS[0].IgnorePopup
|
||||
}
|
||||
return false
|
||||
}
|
||||
|
||||
// updateSummary updates summary of StepResult.
|
||||
func (r *SessionRunner) updateSummary(stepResult *StepResult) {
|
||||
switch stepResult.StepType {
|
||||
|
||||
@@ -48,6 +48,7 @@ type TStep struct {
|
||||
Validators []interface{} `json:"validate,omitempty" yaml:"validate,omitempty"`
|
||||
Export []string `json:"export,omitempty" yaml:"export,omitempty"`
|
||||
Loops int `json:"loops,omitempty" yaml:"loops,omitempty"`
|
||||
IgnorePopup bool `json:"ignore_popup,omitempty" yaml:"ignore_popup,omitempty"`
|
||||
}
|
||||
|
||||
// IStep represents interface for all types for teststeps, includes:
|
||||
|
||||
@@ -647,8 +647,10 @@ func runStepMobileUI(s *SessionRunner, step *TStep) (stepResult *StepResult, err
|
||||
}
|
||||
|
||||
// automatic handling of pop-up windows on each step finished
|
||||
if err2 := uiDriver.ClosePopups(); err2 != nil {
|
||||
log.Error().Err(err2).Str("step", step.Name).Msg("auto handle popup failed")
|
||||
if !step.IgnorePopup && !s.IgnorePopup() {
|
||||
if err2 := uiDriver.ClosePopups(); err2 != nil {
|
||||
log.Error().Err(err2).Str("step", step.Name).Msg("auto handle popup failed")
|
||||
}
|
||||
}
|
||||
|
||||
// save attachments
|
||||
|
||||
Reference in New Issue
Block a user