feat: 新增oppo手动启动一次settings

This commit is contained in:
余泓铮
2024-06-21 11:57:36 +08:00
parent 30d4dcbaa2
commit 3094c3369b
4 changed files with 28 additions and 7 deletions
+8 -7
View File
@@ -18,7 +18,6 @@ import (
"github.com/gorilla/websocket"
"github.com/httprunner/funplugin"
"github.com/httprunner/funplugin/myexec"
"github.com/jinzhu/copier"
"github.com/pkg/errors"
"github.com/rs/zerolog/log"
@@ -26,7 +25,6 @@ import (
"github.com/httprunner/httprunner/v4/hrp/internal/builtin"
"github.com/httprunner/httprunner/v4/hrp/internal/code"
"github.com/httprunner/httprunner/v4/hrp/internal/env"
"github.com/httprunner/httprunner/v4/hrp/internal/sdk"
"github.com/httprunner/httprunner/v4/hrp/internal/version"
"github.com/httprunner/httprunner/v4/hrp/pkg/uixt"
@@ -437,11 +435,15 @@ func (r *CaseRunner) parseConfig() error {
if err != nil {
return errors.Wrap(err, "init iOS device failed")
}
if err := device.Init(); err != nil {
return err
}
client, err := device.NewDriver(uixt.WithDriverPlugin(r.parser.plugin))
if err != nil {
return errors.Wrap(err, "init iOS WDA client failed")
}
r.uiClients[device.UDID] = client
}
for _, androidDeviceConfig := range r.parsedConfig.Android {
if androidDeviceConfig.SerialNumber != "" {
@@ -456,11 +458,15 @@ func (r *CaseRunner) parseConfig() error {
if err != nil {
return errors.Wrap(err, "init Android device failed")
}
if err := device.Init(); err != nil {
return err
}
client, err := device.NewDriver(uixt.WithDriverPlugin(r.parser.plugin))
if err != nil {
return errors.Wrap(err, "init Android client failed")
}
r.uiClients[device.SerialNumber] = client
}
return nil
@@ -525,11 +531,6 @@ func (r *SessionRunner) Start(givenVars map[string]interface{}) error {
config := r.caseRunner.testCase.Config
log.Info().Str("testcase", config.Name).Msg("run testcase start")
// 安卓系统删除打点日志文件
if r.caseRunner.testCase.Config.Android != nil {
myexec.RunCommand("adb", "-s", r.caseRunner.testCase.Config.Android[0].SerialNumber, "shell", "rm", "-r", env.DeviceActionLogFilePath)
}
// update config variables with given variables
r.InitWithParameters(givenVars)