mirror of
https://github.com/httprunner/httprunner.git
synced 2026-09-04 23:16:57 +08:00
refactor: merge Tap and TapFloat
This commit is contained in:
@@ -1 +1 @@
|
|||||||
v5.0.0+2411232207
|
v5.0.0+2411232210
|
||||||
|
|||||||
@@ -74,5 +74,5 @@ func TestDriverExtOCR(t *testing.T) {
|
|||||||
checkErr(t, err)
|
checkErr(t, err)
|
||||||
|
|
||||||
t.Logf("point.X: %v, point.Y: %v", point.X, point.Y)
|
t.Logf("point.X: %v, point.Y: %v", point.X, point.Y)
|
||||||
driverExt.Driver.TapFloat(point.X, point.Y-20)
|
driverExt.Driver.Tap(point.X, point.Y-20)
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -315,11 +315,7 @@ func (ad *adbDriver) AppTerminate(packageName string) (successful bool, err erro
|
|||||||
return true, nil
|
return true, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
func (ad *adbDriver) Tap(x, y int, options ...ActionOption) error {
|
func (ad *adbDriver) Tap(x, y float64, options ...ActionOption) (err error) {
|
||||||
return ad.TapFloat(float64(x), float64(y), options...)
|
|
||||||
}
|
|
||||||
|
|
||||||
func (ad *adbDriver) TapFloat(x, y float64, options ...ActionOption) (err error) {
|
|
||||||
actionOptions := NewActionOptions(options...)
|
actionOptions := NewActionOptions(options...)
|
||||||
|
|
||||||
if len(actionOptions.Offset) == 2 {
|
if len(actionOptions.Offset) == 2 {
|
||||||
@@ -663,7 +659,7 @@ func (ad *adbDriver) tapByTextUsingHierarchy(hierarchy *Hierarchy, text string,
|
|||||||
}
|
}
|
||||||
for _, bound := range bounds {
|
for _, bound := range bounds {
|
||||||
width, height := bound.Center()
|
width, height := bound.Center()
|
||||||
err := ad.TapFloat(width, height, options...)
|
err := ad.Tap(width, height, options...)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -225,7 +225,7 @@ func TestDriver_Tap(t *testing.T) {
|
|||||||
}
|
}
|
||||||
//time.Sleep(time.Second)
|
//time.Sleep(time.Second)
|
||||||
//
|
//
|
||||||
//err = driverExt.Driver.TapFloat(60.5, 125.5, WithIdentifier("test"))
|
//err = driverExt.Driver.Tap(60.5, 125.5, WithIdentifier("test"))
|
||||||
//if err != nil {
|
//if err != nil {
|
||||||
// t.Fatal(err)
|
// t.Fatal(err)
|
||||||
//}
|
//}
|
||||||
|
|||||||
@@ -320,11 +320,7 @@ func (ud *uiaDriver) DoubleFloatTap(x, y float64) error {
|
|||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|
||||||
func (ud *uiaDriver) Tap(x, y int, options ...ActionOption) error {
|
func (ud *uiaDriver) Tap(x, y float64, options ...ActionOption) (err error) {
|
||||||
return ud.TapFloat(float64(x), float64(y), options...)
|
|
||||||
}
|
|
||||||
|
|
||||||
func (ud *uiaDriver) TapFloat(x, y float64, options ...ActionOption) (err error) {
|
|
||||||
// register(postHandler, new Tap("/wd/hub/session/:sessionId/appium/tap"))
|
// register(postHandler, new Tap("/wd/hub/session/:sessionId/appium/tap"))
|
||||||
actionOptions := NewActionOptions(options...)
|
actionOptions := NewActionOptions(options...)
|
||||||
|
|
||||||
|
|||||||
@@ -154,11 +154,7 @@ func (hd *hdcDriver) Orientation() (orientation Orientation, err error) {
|
|||||||
return OrientationPortrait, nil
|
return OrientationPortrait, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
func (hd *hdcDriver) Tap(x, y int, options ...ActionOption) error {
|
func (hd *hdcDriver) Tap(x, y float64, options ...ActionOption) error {
|
||||||
return hd.TapFloat(float64(x), float64(y), options...)
|
|
||||||
}
|
|
||||||
|
|
||||||
func (hd *hdcDriver) TapFloat(x, y float64, options ...ActionOption) error {
|
|
||||||
actionOptions := NewActionOptions(options...)
|
actionOptions := NewActionOptions(options...)
|
||||||
|
|
||||||
if len(actionOptions.Offset) == 2 {
|
if len(actionOptions.Offset) == 2 {
|
||||||
|
|||||||
@@ -577,8 +577,7 @@ type IWebDriver interface {
|
|||||||
Orientation() (orientation Orientation, err error)
|
Orientation() (orientation Orientation, err error)
|
||||||
|
|
||||||
// Tap Sends a tap event at the coordinate.
|
// Tap Sends a tap event at the coordinate.
|
||||||
Tap(x, y int, options ...ActionOption) error
|
Tap(x, y float64, options ...ActionOption) error
|
||||||
TapFloat(x, y float64, options ...ActionOption) error
|
|
||||||
|
|
||||||
// DoubleTap Sends a double tap event at the coordinate.
|
// DoubleTap Sends a double tap event at the coordinate.
|
||||||
DoubleTap(x, y float64, options ...ActionOption) error
|
DoubleTap(x, y float64, options ...ActionOption) error
|
||||||
|
|||||||
@@ -495,11 +495,7 @@ func (wd *wdaDriver) AssertForegroundApp(bundleId string, viewControllerType ...
|
|||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
func (wd *wdaDriver) Tap(x, y int, options ...ActionOption) error {
|
func (wd *wdaDriver) Tap(x, y float64, options ...ActionOption) (err error) {
|
||||||
return wd.TapFloat(float64(x), float64(y), options...)
|
|
||||||
}
|
|
||||||
|
|
||||||
func (wd *wdaDriver) TapFloat(x, y float64, options ...ActionOption) (err error) {
|
|
||||||
// [[FBRoute POST:@"/wda/tap/:uuid"] respondWithTarget:self action:@selector(handleTap:)]
|
// [[FBRoute POST:@"/wda/tap/:uuid"] respondWithTarget:self action:@selector(handleTap:)]
|
||||||
actionOptions := NewActionOptions(options...)
|
actionOptions := NewActionOptions(options...)
|
||||||
|
|
||||||
@@ -548,7 +544,7 @@ func (wd *wdaDriver) TouchAndHold(x, y float64, options ...ActionOption) (err er
|
|||||||
if actionOptions.Duration == 0 {
|
if actionOptions.Duration == 0 {
|
||||||
options = append(options, WithDuration(1))
|
options = append(options, WithDuration(1))
|
||||||
}
|
}
|
||||||
return wd.TapFloat(x, y, options...)
|
return wd.Tap(x, y, options...)
|
||||||
}
|
}
|
||||||
|
|
||||||
func (wd *wdaDriver) Drag(fromX, fromY, toX, toY float64, options ...ActionOption) (err error) {
|
func (wd *wdaDriver) Drag(fromX, fromY, toX, toY float64, options ...ActionOption) (err error) {
|
||||||
|
|||||||
@@ -219,7 +219,7 @@ func (s *stubIOSDriver) Orientation() (orientation Orientation, err error) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Tap Sends a tap event at the coordinate.
|
// Tap Sends a tap event at the coordinate.
|
||||||
func (s *stubIOSDriver) Tap(x, y int, options ...ActionOption) error {
|
func (s *stubIOSDriver) Tap(x, y float64, options ...ActionOption) error {
|
||||||
err := s.setUpWda()
|
err := s.setUpWda()
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
@@ -227,14 +227,6 @@ func (s *stubIOSDriver) Tap(x, y int, options ...ActionOption) error {
|
|||||||
return s.wdaDriver.Tap(x, y, options...)
|
return s.wdaDriver.Tap(x, y, options...)
|
||||||
}
|
}
|
||||||
|
|
||||||
func (s *stubIOSDriver) TapFloat(x, y float64, options ...ActionOption) error {
|
|
||||||
err := s.setUpWda()
|
|
||||||
if err != nil {
|
|
||||||
return err
|
|
||||||
}
|
|
||||||
return s.wdaDriver.TapFloat(x, y, options...)
|
|
||||||
}
|
|
||||||
|
|
||||||
// DoubleTap Sends a double tap event at the coordinate.
|
// DoubleTap Sends a double tap event at the coordinate.
|
||||||
func (s *stubIOSDriver) DoubleTap(x, y float64, options ...ActionOption) error {
|
func (s *stubIOSDriver) DoubleTap(x, y float64, options ...ActionOption) error {
|
||||||
err := s.setUpWda()
|
err := s.setUpWda()
|
||||||
|
|||||||
+1
-1
@@ -10,7 +10,7 @@ import (
|
|||||||
|
|
||||||
func (dExt *DriverExt) TapAbsXY(x, y float64, options ...ActionOption) error {
|
func (dExt *DriverExt) TapAbsXY(x, y float64, options ...ActionOption) error {
|
||||||
// tap on absolute coordinate [x, y]
|
// tap on absolute coordinate [x, y]
|
||||||
err := dExt.Driver.TapFloat(x, y, options...)
|
err := dExt.Driver.Tap(x, y, options...)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return errors.Wrap(code.MobileUITapError, err.Error())
|
return errors.Wrap(code.MobileUITapError, err.Error())
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user