mirror of
https://github.com/httprunner/httprunner.git
synced 2026-06-05 15:59:33 +08:00
fix: convert swipe params with ConvertToFloat64Slice
This commit is contained in:
@@ -1 +1 @@
|
|||||||
v5.0.0+2411152251
|
v5.0.0+2411161744
|
||||||
|
|||||||
@@ -39,8 +39,10 @@ func (d *DriverSession) Reset() {
|
|||||||
d.e2eDelay = nil
|
d.e2eDelay = nil
|
||||||
}
|
}
|
||||||
|
|
||||||
func (d *DriverSession) Get(withReset bool) map[string]interface{} {
|
type Attachments map[string]interface{}
|
||||||
data := map[string]interface{}{
|
|
||||||
|
func (d *DriverSession) Get(withReset bool) Attachments {
|
||||||
|
data := Attachments{
|
||||||
"screen_results": d.screenResults,
|
"screen_results": d.screenResults,
|
||||||
}
|
}
|
||||||
if len(d.e2eDelay) != 0 {
|
if len(d.e2eDelay) != 0 {
|
||||||
|
|||||||
@@ -122,9 +122,9 @@ func (dExt *DriverExt) prepareSwipeAction(params interface{}, options ...ActionO
|
|||||||
return errors.Wrap(code.InvalidParamError,
|
return errors.Wrap(code.InvalidParamError,
|
||||||
fmt.Sprintf("get unexpected swipe direction: %s", d))
|
fmt.Sprintf("get unexpected swipe direction: %s", d))
|
||||||
}
|
}
|
||||||
} else if d, ok := swipeDirection.([]float64); ok && len(d) == 4 {
|
} else if params, err := builtin.ConvertToFloat64Slice(swipeDirection); err == nil && len(params) == 4 {
|
||||||
// custom direction: [fromX, fromY, toX, toY]
|
// custom direction: [fromX, fromY, toX, toY]
|
||||||
if err := dExt.SwipeRelative(d[0], d[1], d[2], d[3], options...); err != nil {
|
if err := dExt.SwipeRelative(params[0], params[1], params[2], params[3], options...); err != nil {
|
||||||
log.Error().Err(err).Msgf("swipe from (%v, %v) to (%v, %v) failed",
|
log.Error().Err(err).Msgf("swipe from (%v, %v) to (%v, %v) failed",
|
||||||
d[0], d[1], d[2], d[3])
|
d[0], d[1], d[2], d[3])
|
||||||
return err
|
return err
|
||||||
|
|||||||
@@ -661,7 +661,7 @@ func runStepMobileUI(s *SessionRunner, step IStep) (stepResult *StepResult, err
|
|||||||
}
|
}
|
||||||
|
|
||||||
defer func() {
|
defer func() {
|
||||||
attachments := make(map[string]interface{})
|
attachments := uixt.Attachments{}
|
||||||
if err != nil {
|
if err != nil {
|
||||||
attachments["error"] = err.Error()
|
attachments["error"] = err.Error()
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user