From 8dc275d5fb8910b24a94f82116e3c086c96774f3 Mon Sep 17 00:00:00 2001 From: debugtalk Date: Tue, 11 Oct 2022 21:28:08 +0800 Subject: [PATCH] fix: ResetHomeOnStartup --- hrp/pkg/uixt/ios_device.go | 12 ++++++------ hrp/runner.go | 3 +++ 2 files changed, 9 insertions(+), 6 deletions(-) diff --git a/hrp/pkg/uixt/ios_device.go b/hrp/pkg/uixt/ios_device.go index 0e95742f..2b148159 100644 --- a/hrp/pkg/uixt/ios_device.go +++ b/hrp/pkg/uixt/ios_device.go @@ -25,9 +25,8 @@ import ( ) const ( - defaultWDAPort = 8100 - defaultMjpegPort = 9100 - defaultResetHomeOnStartup = true + defaultWDAPort = 8100 + defaultMjpegPort = 9100 ) const ( @@ -132,7 +131,6 @@ func NewIOSDevice(options ...IOSDeviceOption) (device *IOSDevice, err error) { device = &IOSDevice{ Port: defaultWDAPort, MjpegPort: defaultMjpegPort, - ResetHomeOnStartup: defaultResetHomeOnStartup, SnapshotMaxDepth: snapshotMaxDepth, AcceptAlertButtonSelector: acceptAlertButtonSelector, DismissAlertButtonSelector: dismissAlertButtonSelector, @@ -163,9 +161,11 @@ type IOSDevice struct { Port int `json:"port,omitempty" yaml:"port,omitempty"` // WDA remote 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"` + // switch to iOS springboard before init WDA session - // avoid getting stuck when some super app is activate such as douyin or wexin - 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"` + + // config appium settings SnapshotMaxDepth int `json:"snapshot_max_depth,omitempty" yaml:"snapshot_max_depth,omitempty"` AcceptAlertButtonSelector string `json:"accept_alert_button_selector,omitempty" yaml:"accept_alert_button_selector,omitempty"` DismissAlertButtonSelector string `json:"dismiss_alert_button_selector,omitempty" yaml:"dismiss_alert_button_selector,omitempty"` diff --git a/hrp/runner.go b/hrp/runner.go index a587adc1..9b2380cf 100644 --- a/hrp/runner.go +++ b/hrp/runner.go @@ -397,6 +397,9 @@ func (r *testCaseRunner) parseConfig() error { } iosDeviceConfig.UDID = udid.(string) } + // switch to iOS springboard before init WDA session + // avoid getting stuck when some super app is activate such as douyin or wexin + iosDeviceConfig.ResetHomeOnStartup = true _, err := r.hrpRunner.initUIClient(iosDeviceConfig) if err != nil { return errors.Wrap(err, "init iOS WDA client failed")