From 14405d56a659986dc531f8efe8a0a87ab8d6b928 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=BE=90=E8=81=AA?= Date: Mon, 15 Aug 2022 20:50:01 +0800 Subject: [PATCH 1/4] annotation wg.wait --- hrp/pkg/boomer/runner.go | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/hrp/pkg/boomer/runner.go b/hrp/pkg/boomer/runner.go index d9e5d5f4..171e9313 100644 --- a/hrp/pkg/boomer/runner.go +++ b/hrp/pkg/boomer/runner.go @@ -670,8 +670,8 @@ func (r *localRunner) start() { close(r.controller.rebalance) r.wgMu.Unlock() - // wait for goroutines before closing - r.wg.Wait() + //// wait for goroutines before closing + //r.wg.Wait() close(r.doneChan) From 799752c6c40d13711ec33f7d2f95c6061c8cf77c Mon Sep 17 00:00:00 2001 From: "xucong.053" Date: Sun, 23 Oct 2022 16:34:22 +0800 Subject: [PATCH 2/4] fix: failed to record the android ui step type in the step result --- hrp/pkg/boomer/runner.go | 4 ++-- hrp/step_mobile_ui.go | 33 ++++++++++++++++++--------------- 2 files changed, 20 insertions(+), 17 deletions(-) diff --git a/hrp/pkg/boomer/runner.go b/hrp/pkg/boomer/runner.go index 171e9313..d9e5d5f4 100644 --- a/hrp/pkg/boomer/runner.go +++ b/hrp/pkg/boomer/runner.go @@ -670,8 +670,8 @@ func (r *localRunner) start() { close(r.controller.rebalance) r.wgMu.Unlock() - //// wait for goroutines before closing - //r.wg.Wait() + // wait for goroutines before closing + r.wg.Wait() close(r.doneChan) diff --git a/hrp/step_mobile_ui.go b/hrp/step_mobile_ui.go index 3a0cd143..3bf934cd 100644 --- a/hrp/step_mobile_ui.go +++ b/hrp/step_mobile_ui.go @@ -356,6 +356,9 @@ func (s *StepMobile) Name() string { } func (s *StepMobile) Type() StepType { + if s.step.Android != nil { + return stepTypeAndroid + } return stepTypeIOS } @@ -548,21 +551,6 @@ func (r *HRPRunner) initUIClient(uuid string, osType string) (client *uixt.Drive } func runStepMobileUI(s *SessionRunner, step *TStep) (stepResult *StepResult, err error) { - stepResult = &StepResult{ - Name: step.Name, - StepType: stepTypeIOS, - Success: false, - ContentSize: 0, - } - screenshots := make([]string, 0) - - // merge step variables with session variables - stepVariables, err := s.ParseStepVariables(step.Variables) - if err != nil { - err = errors.Wrap(err, "parse step variables failed") - return - } - var osType string var mobileStep *MobileStep if step.IOS != nil { @@ -575,6 +563,21 @@ func runStepMobileUI(s *SessionRunner, step *TStep) (stepResult *StepResult, err mobileStep = step.Android } + stepResult = &StepResult{ + Name: step.Name, + StepType: StepType(osType), + Success: false, + ContentSize: 0, + } + screenshots := make([]string, 0) + + // merge step variables with session variables + stepVariables, err := s.ParseStepVariables(step.Variables) + if err != nil { + err = errors.Wrap(err, "parse step variables failed") + return + } + // init wda/uia driver uiDriver, err := s.caseRunner.hrpRunner.initUIClient(mobileStep.Serial, osType) if err != nil { From 71ff91fee304386f65c10e58100e344933e20253 Mon Sep 17 00:00:00 2001 From: "xucong.053" Date: Sun, 23 Oct 2022 16:52:23 +0800 Subject: [PATCH 3/4] change: update the ocr scope of the FindText function --- hrp/pkg/uixt/ocr_vedem.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/hrp/pkg/uixt/ocr_vedem.go b/hrp/pkg/uixt/ocr_vedem.go index 1bae01ad..3f456045 100644 --- a/hrp/pkg/uixt/ocr_vedem.go +++ b/hrp/pkg/uixt/ocr_vedem.go @@ -170,7 +170,7 @@ func (s *veDEMOCRService) FindText(text string, imageBuf []byte, options ...Data Y: int(ocrResult.Points[2].Y), }, } - if rect.Min.X > data.Scope[0] && rect.Max.X < data.Scope[2] && rect.Min.Y > data.Scope[1] && rect.Max.Y < data.Scope[3] { + if rect.Min.X >= data.Scope[0] && rect.Max.X <= data.Scope[2] && rect.Min.Y >= data.Scope[1] && rect.Max.Y <= data.Scope[3] { ocrTexts = append(ocrTexts, ocrResult.Text) // not contains text From 30421f2945172994234e19ac6b401bc41be3e562 Mon Sep 17 00:00:00 2001 From: "xucong.053" Date: Sun, 23 Oct 2022 17:29:03 +0800 Subject: [PATCH 4/4] fix: failed to return exit code correctly --- hrp/internal/code/code.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/hrp/internal/code/code.go b/hrp/internal/code/code.go index 48557401..8444d6a1 100644 --- a/hrp/internal/code/code.go +++ b/hrp/internal/code/code.go @@ -135,7 +135,7 @@ var errorsMap = map[error]int{ } func IsErrorPredefined(err error) bool { - _, ok := errorsMap[err] + _, ok := errorsMap[errors.Cause(err)] return ok }