mirror of
https://github.com/httprunner/httprunner.git
synced 2026-09-04 23:16:57 +08:00
feat: report MobileUITapError/MobileUISwipeError/MobileUIInputError
This commit is contained in:
+14
-7
@@ -2,11 +2,16 @@ package uixt
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
|
||||
"github.com/pkg/errors"
|
||||
|
||||
"github.com/httprunner/httprunner/v4/hrp/code"
|
||||
)
|
||||
|
||||
func (dExt *DriverExt) TapAbsXY(x, y float64, options ...ActionOption) error {
|
||||
// tap on absolute coordinate [x, y]
|
||||
return dExt.Driver.TapFloat(x, y, options...)
|
||||
err := dExt.Driver.TapFloat(x, y, options...)
|
||||
return errors.Wrap(code.MobileUITapError, err.Error())
|
||||
}
|
||||
|
||||
func (dExt *DriverExt) TapXY(x, y float64, options ...ActionOption) error {
|
||||
@@ -70,7 +75,7 @@ func (dExt *DriverExt) TapOffset(param string, xOffset, yOffset float64, options
|
||||
return dExt.TapAbsXY(point.X+xOffset, point.Y+yOffset, options...)
|
||||
}
|
||||
|
||||
func (dExt *DriverExt) DoubleTapXY(x, y float64) error {
|
||||
func (dExt *DriverExt) DoubleTapXY(x, y float64, options ...ActionOption) error {
|
||||
// double tap on coordinate: [x, y] should be relative
|
||||
if x > 1 || y > 1 {
|
||||
return fmt.Errorf("x, y percentage should be < 1, got x=%v, y=%v", x, y)
|
||||
@@ -82,18 +87,20 @@ func (dExt *DriverExt) DoubleTapXY(x, y float64) error {
|
||||
}
|
||||
x = x * float64(windowSize.Width)
|
||||
y = y * float64(windowSize.Height)
|
||||
return dExt.Driver.DoubleTapFloat(x, y)
|
||||
err = dExt.Driver.DoubleTapFloat(x, y, options...)
|
||||
return errors.Wrap(code.MobileUITapError, err.Error())
|
||||
}
|
||||
|
||||
func (dExt *DriverExt) DoubleTap(param string) (err error) {
|
||||
return dExt.DoubleTapOffset(param, 0, 0)
|
||||
func (dExt *DriverExt) DoubleTap(param string, options ...ActionOption) (err error) {
|
||||
return dExt.DoubleTapOffset(param, 0, 0, options...)
|
||||
}
|
||||
|
||||
func (dExt *DriverExt) DoubleTapOffset(param string, xOffset, yOffset float64) (err error) {
|
||||
func (dExt *DriverExt) DoubleTapOffset(param string, xOffset, yOffset float64, options ...ActionOption) (err error) {
|
||||
point, err := dExt.FindUIRectInUIKit(param)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
return dExt.Driver.DoubleTapFloat(point.X+xOffset, point.Y+yOffset)
|
||||
err = dExt.Driver.DoubleTapFloat(point.X+xOffset, point.Y+yOffset, options...)
|
||||
return errors.Wrap(code.MobileUITapError, err.Error())
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user