fix: ResetHomeOnStartup

This commit is contained in:
debugtalk
2022-10-11 21:28:08 +08:00
parent fa7e2754af
commit 8dc275d5fb
2 changed files with 9 additions and 6 deletions

View File

@@ -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"`

View File

@@ -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")