mirror of
https://github.com/httprunner/httprunner.git
synced 2026-07-20 03:52:09 +08:00
fix: SwipeRelative error code
This commit is contained in:
@@ -24,7 +24,7 @@ var (
|
|||||||
LoadYAMLError = errors.New("load yaml error") // 12
|
LoadYAMLError = errors.New("load yaml error") // 12
|
||||||
LoadEnvError = errors.New("load .env error") // 13
|
LoadEnvError = errors.New("load .env error") // 13
|
||||||
LoadCSVError = errors.New("load csv error") // 14
|
LoadCSVError = errors.New("load csv error") // 14
|
||||||
InvalidCaseFormat = errors.New("invalid case format") // 15
|
InvalidCaseError = errors.New("invalid case error") // 15
|
||||||
UnsupportedFileExtension = errors.New("unsupported file extension") // 16
|
UnsupportedFileExtension = errors.New("unsupported file extension") // 16
|
||||||
ReferencedFileNotFound = errors.New("referenced file not found") // 17
|
ReferencedFileNotFound = errors.New("referenced file not found") // 17
|
||||||
InvalidPluginFile = errors.New("invalid plugin file") // 18
|
InvalidPluginFile = errors.New("invalid plugin file") // 18
|
||||||
@@ -64,6 +64,7 @@ var (
|
|||||||
DeviceConnectionError = errors.New("device general connection error") // 50
|
DeviceConnectionError = errors.New("device general connection error") // 50
|
||||||
DeviceHTTPDriverError = errors.New("device HTTP driver error") // 51
|
DeviceHTTPDriverError = errors.New("device HTTP driver error") // 51
|
||||||
DeviceUSBDriverError = errors.New("device USB driver error") // 52
|
DeviceUSBDriverError = errors.New("device USB driver error") // 52
|
||||||
|
DeviceGetInfoError = errors.New("device get info error") // 60
|
||||||
DeviceShellExecError = errors.New("device shell exec error") // 62
|
DeviceShellExecError = errors.New("device shell exec error") // 62
|
||||||
DeviceOfflineError = errors.New("device offline") // 63
|
DeviceOfflineError = errors.New("device offline") // 63
|
||||||
DeviceScreenShotError = errors.New("device screenshot error") // 65
|
DeviceScreenShotError = errors.New("device screenshot error") // 65
|
||||||
@@ -121,7 +122,7 @@ var errorsMap = map[error]int{
|
|||||||
LoadYAMLError: 12,
|
LoadYAMLError: 12,
|
||||||
LoadEnvError: 13,
|
LoadEnvError: 13,
|
||||||
LoadCSVError: 14,
|
LoadCSVError: 14,
|
||||||
InvalidCaseFormat: 15,
|
InvalidCaseError: 15,
|
||||||
UnsupportedFileExtension: 16,
|
UnsupportedFileExtension: 16,
|
||||||
ReferencedFileNotFound: 17,
|
ReferencedFileNotFound: 17,
|
||||||
InvalidPluginFile: 18,
|
InvalidPluginFile: 18,
|
||||||
@@ -153,6 +154,7 @@ var errorsMap = map[error]int{
|
|||||||
DeviceConnectionError: 50,
|
DeviceConnectionError: 50,
|
||||||
DeviceHTTPDriverError: 51,
|
DeviceHTTPDriverError: 51,
|
||||||
DeviceUSBDriverError: 52,
|
DeviceUSBDriverError: 52,
|
||||||
|
DeviceGetInfoError: 60,
|
||||||
DeviceShellExecError: 62,
|
DeviceShellExecError: 62,
|
||||||
DeviceOfflineError: 63,
|
DeviceOfflineError: 63,
|
||||||
DeviceScreenShotError: 65,
|
DeviceScreenShotError: 65,
|
||||||
|
|||||||
@@ -19,14 +19,14 @@ func assertRelative(p float64) bool {
|
|||||||
func (dExt *DriverExt) SwipeRelative(fromX, fromY, toX, toY float64, options ...ActionOption) error {
|
func (dExt *DriverExt) SwipeRelative(fromX, fromY, toX, toY float64, options ...ActionOption) error {
|
||||||
if !assertRelative(fromX) || !assertRelative(fromY) ||
|
if !assertRelative(fromX) || !assertRelative(fromY) ||
|
||||||
!assertRelative(toX) || !assertRelative(toY) {
|
!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",
|
fmt.Sprintf("fromX(%f), fromY(%f), toX(%f), toY(%f) must be less than 1",
|
||||||
fromX, fromY, toX, toY))
|
fromX, fromY, toX, toY))
|
||||||
}
|
}
|
||||||
|
|
||||||
windowSize, err := dExt.Driver.WindowSize()
|
windowSize, err := dExt.Driver.WindowSize()
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return errors.Wrap(code.MobileUISwipeError, err.Error())
|
return errors.Wrap(code.DeviceGetInfoError, err.Error())
|
||||||
}
|
}
|
||||||
width := windowSize.Width
|
width := windowSize.Width
|
||||||
height := windowSize.Height
|
height := windowSize.Height
|
||||||
|
|||||||
Reference in New Issue
Block a user