Merge pull request #1497 from httprunner/dev-v4.3-bugfix

fix: failed to using SwipeToTapTexts
This commit is contained in:
debugtalk
2022-10-14 15:36:05 +08:00
committed by GitHub
2 changed files with 10 additions and 1 deletions

View File

@@ -444,7 +444,7 @@ func (dExt *DriverExt) DoAction(action MobileAction) error {
return err
}
for _, point = range points {
if point != (PointF{}) {
if point != (PointF{X: 0, Y: 0}) {
return nil
}
}

View File

@@ -3,6 +3,7 @@ package uixt
import (
"fmt"
"github.com/httprunner/httprunner/v4/hrp/internal/builtin"
"github.com/rs/zerolog/log"
)
@@ -86,6 +87,14 @@ func (dExt *DriverExt) SwipeUntil(direction interface{}, condition FindCondition
if err := dExt.SwipeRelative(d[0], d[1], d[2], d[3]); err != nil {
log.Error().Err(err).Msgf("swipe %s failed", d)
}
} else if d, ok := direction.([]interface{}); ok {
sx, _ := builtin.Interface2Float64(d[0])
sy, _ := builtin.Interface2Float64(d[1])
ex, _ := builtin.Interface2Float64(d[2])
ey, _ := builtin.Interface2Float64(d[3])
if err := dExt.SwipeRelative(sx, sy, ex, ey); err != nil {
log.Error().Err(err).Msgf("swipe (%v, %v) to (%v, %v) failed", sx, sy, ex, ey)
}
}
}
return fmt.Errorf("swipe %s %d times, match condition failed", direction, maxTimes)