change: return error if action not implemented

This commit is contained in:
lilong.129
2025-01-07 15:15:19 +08:00
parent 8fd9723d4a
commit b731669da2
2 changed files with 7 additions and 3 deletions

View File

@@ -1 +1 @@
v5.0.0+2501062030 v5.0.0+2501071515

View File

@@ -10,6 +10,7 @@ import (
"github.com/rs/zerolog" "github.com/rs/zerolog"
"github.com/rs/zerolog/log" "github.com/rs/zerolog/log"
"github.com/httprunner/httprunner/v4/hrp/code"
"github.com/httprunner/httprunner/v4/hrp/internal/builtin" "github.com/httprunner/httprunner/v4/hrp/internal/builtin"
) )
@@ -783,6 +784,11 @@ func (dExt *DriverExt) DoAction(action MobileAction) (err error) {
case ACTION_CallFunction: case ACTION_CallFunction:
fn := action.Fn fn := action.Fn
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 return nil
} }
@@ -793,8 +799,6 @@ type SleepConfig struct {
Milliseconds int64 `json:"milliseconds,omitempty"` Milliseconds int64 `json:"milliseconds,omitempty"`
} }
var errActionNotImplemented = errors.New("UI action not implemented")
// getSimulationDuration returns simulation duration by given params (in seconds) // getSimulationDuration returns simulation duration by given params (in seconds)
func getSimulationDuration(params []float64) (milliseconds int64) { func getSimulationDuration(params []float64) (milliseconds int64) {
if len(params) == 1 { if len(params) == 1 {