fix: SwipeRelative error code

This commit is contained in:
lilong.129
2024-09-19 10:47:33 +08:00
parent dd5ba31b63
commit ead8475f2f
2 changed files with 6 additions and 4 deletions

View File

@@ -19,14 +19,14 @@ func assertRelative(p float64) bool {
func (dExt *DriverExt) SwipeRelative(fromX, fromY, toX, toY float64, options ...ActionOption) error {
if !assertRelative(fromX) || !assertRelative(fromY) ||
!assertRelative(toX) || !assertRelative(toY) {
return errors.Wrap(code.MobileUISwipeError,
return errors.Wrap(code.InvalidCaseError,
fmt.Sprintf("fromX(%f), fromY(%f), toX(%f), toY(%f) must be less than 1",
fromX, fromY, toX, toY))
}
windowSize, err := dExt.Driver.WindowSize()
if err != nil {
return errors.Wrap(code.MobileUISwipeError, err.Error())
return errors.Wrap(code.DeviceGetInfoError, err.Error())
}
width := windowSize.Width
height := windowSize.Height