mirror of
https://github.com/httprunner/httprunner.git
synced 2026-07-12 16:01:27 +08:00
fix: keep compatibility for config ignore_popup
This commit is contained in:
18
runner.go
18
runner.go
@@ -1077,6 +1077,24 @@ func (r *SessionRunner) GetTransactions() map[string]map[TransactionType]time.Ti
|
|||||||
return r.transactions
|
return r.transactions
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// keep for compatibility
|
||||||
|
func (r *SessionRunner) ignorePopup(osType string) bool {
|
||||||
|
config := r.caseRunner.TestCase.Config.Get()
|
||||||
|
if osType == string(StepTypeAndroid) && len(config.Android) > 0 {
|
||||||
|
return config.Android[0].IgnorePopup
|
||||||
|
}
|
||||||
|
if osType == string(StepTypeIOS) && len(config.IOS) > 0 {
|
||||||
|
return config.IOS[0].IgnorePopup
|
||||||
|
}
|
||||||
|
if osType == string(StepTypeHarmony) && len(config.Harmony) > 0 {
|
||||||
|
return config.Harmony[0].IgnorePopup
|
||||||
|
}
|
||||||
|
if osType == string(stepTypeBrowser) && len(config.Browser) > 0 {
|
||||||
|
return config.Browser[0].IgnorePopup
|
||||||
|
}
|
||||||
|
return false
|
||||||
|
}
|
||||||
|
|
||||||
// saveJSONCase saves the original JSON case content to the results directory
|
// saveJSONCase saves the original JSON case content to the results directory
|
||||||
func saveJSONCase(casePath string) error {
|
func saveJSONCase(casePath string) error {
|
||||||
// Read the original JSON case content
|
// Read the original JSON case content
|
||||||
|
|||||||
@@ -798,10 +798,11 @@ func runStepMobileUI(s *SessionRunner, step IStep) (stepResult *StepResult, err
|
|||||||
config = s.caseRunner.Config.Get()
|
config = s.caseRunner.Config.Get()
|
||||||
}
|
}
|
||||||
// automatic handling of pop-up windows on each step finished, default to disabled
|
// automatic handling of pop-up windows on each step finished, default to disabled
|
||||||
// priority: step ignore_popup > config auto_popup_handler > step auto_popup_handler
|
// priority: config ignore_popup > step ignore_popup > config auto_popup_handler > step auto_popup_handler
|
||||||
shouldHandlePopup := false
|
shouldHandlePopup := false
|
||||||
|
if s.ignorePopup(mobileStep.OSType) {
|
||||||
if stepIgnorePopup {
|
shouldHandlePopup = false
|
||||||
|
} else if stepIgnorePopup {
|
||||||
// step level config, keep for compatibility
|
// step level config, keep for compatibility
|
||||||
shouldHandlePopup = false
|
shouldHandlePopup = false
|
||||||
} else if config != nil && config.AutoPopupHandler {
|
} else if config != nil && config.AutoPopupHandler {
|
||||||
|
|||||||
@@ -5,6 +5,7 @@ import "github.com/httprunner/httprunner/v5/pkg/gadb"
|
|||||||
type AndroidDeviceOptions struct {
|
type AndroidDeviceOptions struct {
|
||||||
SerialNumber string `json:"serial,omitempty" yaml:"serial,omitempty"`
|
SerialNumber string `json:"serial,omitempty" yaml:"serial,omitempty"`
|
||||||
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"` // keep for compatibility
|
||||||
|
|
||||||
// adb
|
// adb
|
||||||
AdbServerHost string `json:"adb_server_host,omitempty" yaml:"adb_server_host,omitempty"`
|
AdbServerHost string `json:"adb_server_host,omitempty" yaml:"adb_server_host,omitempty"`
|
||||||
|
|||||||
@@ -9,10 +9,11 @@ func NewBrowserDeviceOptions(opts ...BrowserDeviceOption) *BrowserDeviceOptions
|
|||||||
}
|
}
|
||||||
|
|
||||||
type BrowserDeviceOptions struct {
|
type BrowserDeviceOptions struct {
|
||||||
BrowserID string `json:"browser_id,omitempty" yaml:"browser_id,omitempty"`
|
BrowserID string `json:"browser_id,omitempty" yaml:"browser_id,omitempty"`
|
||||||
LogOn bool `json:"log_on,omitempty" yaml:"log_on,omitempty"`
|
LogOn bool `json:"log_on,omitempty" yaml:"log_on,omitempty"`
|
||||||
Width int `json:"width,omitempty" yaml:"width,omitempty"`
|
IgnorePopup bool `json:"ignore_popup,omitempty" yaml:"ignore_popup,omitempty"` // keep for compatibility
|
||||||
Height int `json:"height,omitempty" yaml:"height,omitempty"`
|
Width int `json:"width,omitempty" yaml:"width,omitempty"`
|
||||||
|
Height int `json:"height,omitempty" yaml:"height,omitempty"`
|
||||||
}
|
}
|
||||||
|
|
||||||
func (dev *BrowserDeviceOptions) Options() (deviceOptions []BrowserDeviceOption) {
|
func (dev *BrowserDeviceOptions) Options() (deviceOptions []BrowserDeviceOption) {
|
||||||
|
|||||||
@@ -8,8 +8,9 @@ const (
|
|||||||
)
|
)
|
||||||
|
|
||||||
type HarmonyDeviceOptions struct {
|
type HarmonyDeviceOptions struct {
|
||||||
ConnectKey string `json:"connect_key,omitempty" yaml:"connect_key,omitempty"`
|
ConnectKey string `json:"connect_key,omitempty" yaml:"connect_key,omitempty"`
|
||||||
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"` // keep for compatibility
|
||||||
}
|
}
|
||||||
|
|
||||||
func (dev *HarmonyDeviceOptions) Options() (deviceOptions []HarmonyDeviceOption) {
|
func (dev *HarmonyDeviceOptions) Options() (deviceOptions []HarmonyDeviceOption) {
|
||||||
|
|||||||
@@ -6,6 +6,7 @@ type IOSDeviceOptions struct {
|
|||||||
WDAPort int `json:"port,omitempty" yaml:"port,omitempty"` // WDA remote port
|
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
|
WDAMjpegPort 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"`
|
||||||
|
IgnorePopup bool `json:"ignore_popup,omitempty" yaml:"ignore_popup,omitempty"` // keep for compatibility
|
||||||
|
|
||||||
// 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"`
|
||||||
|
|||||||
Reference in New Issue
Block a user