mirror of
https://github.com/httprunner/httprunner.git
synced 2026-08-10 00:04:40 +08:00
feat: 新增oppo手动启动一次settings
This commit is contained in:
@@ -13,6 +13,7 @@ import (
|
||||
"github.com/rs/zerolog/log"
|
||||
|
||||
"github.com/httprunner/httprunner/v4/hrp/internal/code"
|
||||
"github.com/httprunner/httprunner/v4/hrp/internal/env"
|
||||
"github.com/httprunner/httprunner/v4/hrp/internal/json"
|
||||
"github.com/httprunner/httprunner/v4/hrp/pkg/gadb"
|
||||
)
|
||||
@@ -157,6 +158,20 @@ type AndroidDevice struct {
|
||||
IgnorePopup bool `json:"ignore_popup,omitempty" yaml:"ignore_popup,omitempty"`
|
||||
}
|
||||
|
||||
func (dev *AndroidDevice) Init() error {
|
||||
brand, err := dev.d.Brand()
|
||||
if err != nil {
|
||||
return fmt.Errorf("failed to init android device. brand is null %v", err)
|
||||
}
|
||||
if strings.ToLower(brand) == "huawei" {
|
||||
// 启动一次io.appium.settings。防止oppo设备上切换输入法失败
|
||||
myexec.RunCommand("adb", "-s", dev.SerialNumber, "shell",
|
||||
"monkey", "-p", "io.appium.settings", "-c", "android.intent.category.LAUNCHER", "1")
|
||||
}
|
||||
myexec.RunCommand("adb", "-s", dev.SerialNumber, "shell", "rm", "-r", env.DeviceActionLogFilePath)
|
||||
return nil
|
||||
}
|
||||
|
||||
func (dev *AndroidDevice) UUID() string {
|
||||
return dev.SerialNumber
|
||||
}
|
||||
|
||||
@@ -468,6 +468,7 @@ func WithDriverPlugin(plugin funplugin.IPlugin) DriverOption {
|
||||
|
||||
// current implemeted device: IOSDevice, AndroidDevice
|
||||
type Device interface {
|
||||
Init() error // init android device
|
||||
UUID() string // ios udid or android serial
|
||||
LogEnabled() bool
|
||||
NewDriver(...DriverOption) (driverExt *DriverExt, err error)
|
||||
|
||||
@@ -295,6 +295,10 @@ type IOSDevice struct {
|
||||
pcapFile string // saved pcap file path
|
||||
}
|
||||
|
||||
func (dev *IOSDevice) Init() error {
|
||||
return nil
|
||||
}
|
||||
|
||||
func (dev *IOSDevice) UUID() string {
|
||||
return dev.UDID
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user