fix: failed to parse in android ui automation

This commit is contained in:
xucong053
2022-09-29 17:18:26 +08:00
parent 3492101eab
commit c405f52d7f

View File

@@ -4,9 +4,9 @@ import (
"fmt"
"time"
"github.com/rs/zerolog/log"
"github.com/httprunner/httprunner/v4/hrp/internal/uixt"
"github.com/pkg/errors"
"github.com/rs/zerolog/log"
)
var (
@@ -466,6 +466,13 @@ func runStepAndroid(s *SessionRunner, step *TStep) (stepResult *StepResult, err
}
screenshots := make([]string, 0)
// override step variables
stepVariables, err := s.MergeStepVariables(step.Variables)
if err != nil {
return
}
parser := s.GetParser()
// init uiaClient driver
uiaClient, err := s.hrpRunner.initUIClient(&step.Android.AndroidDevice)
if err != nil {
@@ -511,6 +518,9 @@ func runStepAndroid(s *SessionRunner, step *TStep) (stepResult *StepResult, err
// run actions
for _, action := range actions {
if action.Params, err = parser.Parse(action.Params, stepVariables); err != nil {
return stepResult, errors.Wrap(err, "parse action params failed")
}
if err := uiaClient.DoAction(action); err != nil {
return stepResult, err
}