mirror of
https://github.com/httprunner/httprunner.git
synced 2026-09-05 23:51:25 +08:00
refactor: NewDataOptions and NewData
This commit is contained in:
+6
-6
@@ -65,11 +65,11 @@ func (dExt *DriverExt) GetImageXY(imagePath string, options ...DataOption) (poin
|
||||
}
|
||||
|
||||
func (dExt *DriverExt) TapByOCR(ocrText string, options ...DataOption) error {
|
||||
data := NewData(map[string]interface{}{}, options...)
|
||||
dataOptions := NewDataOptions(options...)
|
||||
|
||||
point, err := dExt.GetTextXY(ocrText, options...)
|
||||
if err != nil {
|
||||
if data.IgnoreNotFoundError {
|
||||
if dataOptions.IgnoreNotFoundError {
|
||||
return nil
|
||||
}
|
||||
return err
|
||||
@@ -79,11 +79,11 @@ func (dExt *DriverExt) TapByOCR(ocrText string, options ...DataOption) error {
|
||||
}
|
||||
|
||||
func (dExt *DriverExt) TapByCV(imagePath string, options ...DataOption) error {
|
||||
data := NewData(map[string]interface{}{}, options...)
|
||||
dataOptions := NewDataOptions(options...)
|
||||
|
||||
point, err := dExt.GetImageXY(imagePath, options...)
|
||||
if err != nil {
|
||||
if data.IgnoreNotFoundError {
|
||||
if dataOptions.IgnoreNotFoundError {
|
||||
return nil
|
||||
}
|
||||
return err
|
||||
@@ -103,11 +103,11 @@ func (dExt *DriverExt) TapOffset(param string, xOffset, yOffset float64, options
|
||||
return ele.Click()
|
||||
}
|
||||
|
||||
data := NewData(map[string]interface{}{}, options...)
|
||||
dataOptions := NewDataOptions(options...)
|
||||
|
||||
x, y, width, height, err := dExt.FindUIRectInUIKit(param, options...)
|
||||
if err != nil {
|
||||
if data.IgnoreNotFoundError {
|
||||
if dataOptions.IgnoreNotFoundError {
|
||||
return nil
|
||||
}
|
||||
return err
|
||||
|
||||
Reference in New Issue
Block a user