From b731669da2a49d79e840e089848253d7a9d06865 Mon Sep 17 00:00:00 2001 From: "lilong.129" Date: Tue, 7 Jan 2025 15:15:19 +0800 Subject: [PATCH] change: return error if action not implemented --- hrp/internal/version/VERSION | 2 +- hrp/pkg/uixt/action.go | 8 ++++++-- 2 files changed, 7 insertions(+), 3 deletions(-) diff --git a/hrp/internal/version/VERSION b/hrp/internal/version/VERSION index 97969b8f..6dfb6481 100644 --- a/hrp/internal/version/VERSION +++ b/hrp/internal/version/VERSION @@ -1 +1 @@ -v5.0.0+2501062030 +v5.0.0+2501071515 diff --git a/hrp/pkg/uixt/action.go b/hrp/pkg/uixt/action.go index 33343f59..6d7266e7 100644 --- a/hrp/pkg/uixt/action.go +++ b/hrp/pkg/uixt/action.go @@ -10,6 +10,7 @@ import ( "github.com/rs/zerolog" "github.com/rs/zerolog/log" + "github.com/httprunner/httprunner/v4/hrp/code" "github.com/httprunner/httprunner/v4/hrp/internal/builtin" ) @@ -783,6 +784,11 @@ func (dExt *DriverExt) DoAction(action MobileAction) (err error) { case ACTION_CallFunction: fn := action.Fn fn() + return nil + default: + log.Warn().Str("action", string(action.Method)).Msg("action not implemented") + return errors.Wrapf(code.InvalidCaseError, + "UI action %v not implemented", action.Method) } return nil } @@ -793,8 +799,6 @@ type SleepConfig struct { Milliseconds int64 `json:"milliseconds,omitempty"` } -var errActionNotImplemented = errors.New("UI action not implemented") - // getSimulationDuration returns simulation duration by given params (in seconds) func getSimulationDuration(params []float64) (milliseconds int64) { if len(params) == 1 {