From 3613ffb2c096a7c14ba890dd20d256c2b86ddfab Mon Sep 17 00:00:00 2001 From: buyuxiang <347586493@qq.com> Date: Tue, 26 Sep 2023 18:09:47 +0800 Subject: [PATCH] fix: compatible with swipe params --- hrp/internal/version/VERSION | 2 +- hrp/pkg/uixt/swipe.go | 2 +- hrp/testcase.go | 3 +++ 3 files changed, 5 insertions(+), 2 deletions(-) diff --git a/hrp/internal/version/VERSION b/hrp/internal/version/VERSION index 471e7432..9c6a0187 100644 --- a/hrp/internal/version/VERSION +++ b/hrp/internal/version/VERSION @@ -1 +1 @@ -v4.3.6 \ No newline at end of file +v4.3.6.20230926 \ No newline at end of file diff --git a/hrp/pkg/uixt/swipe.go b/hrp/pkg/uixt/swipe.go index 0e34e23b..5ee1c408 100644 --- a/hrp/pkg/uixt/swipe.go +++ b/hrp/pkg/uixt/swipe.go @@ -114,7 +114,7 @@ func (dExt *DriverExt) prepareSwipeAction(options ...ActionOption) func(d *Drive log.Error().Err(err).Msgf("swipe %s failed", d) return err } - } else if d, ok := swipeDirection.([]float64); ok { + } else if d, ok := swipeDirection.([]float64); ok && len(d) == 4 { // custom direction: [fromX, fromY, toX, toY] if err := dExt.SwipeRelative(d[0], d[1], d[2], d[3], options...); err != nil { log.Error().Err(err).Msgf("swipe from (%v, %v) to (%v, %v) failed", diff --git a/hrp/testcase.go b/hrp/testcase.go index 3640f6f5..9b301465 100644 --- a/hrp/testcase.go +++ b/hrp/testcase.go @@ -380,6 +380,9 @@ func convertCompatMobileStep(mobileStep *MobileStep) { if ma.Method == uixt.ACTION_SwipeToTapText && actionOptions.MaxRetryTimes == 0 { ma.ActionOptions.MaxRetryTimes = 10 } + if ma.Method == uixt.ACTION_Swipe { + ma.ActionOptions.Direction = ma.Params + } mobileStep.Actions[i] = ma } }