mirror of
https://github.com/httprunner/httprunner.git
synced 2026-06-06 00:09:37 +08:00
fix: unittest
This commit is contained in:
@@ -67,7 +67,6 @@ type MobileAction struct {
|
||||
Identifier string `json:"identifier,omitempty" yaml:"identifier,omitempty"` // used to identify the action in log
|
||||
MaxRetryTimes int `json:"max_retry_times,omitempty" yaml:"max_retry_times,omitempty"` // max retry times
|
||||
Direction interface{} `json:"direction,omitempty" yaml:"direction,omitempty"` // used by swipe to tap text or app
|
||||
Function string `json:"function,omitempty" yaml:"function,omitempty"` // used to replace params
|
||||
Index int `json:"index,omitempty" yaml:"index,omitempty"` // index of the target element, should start from 1
|
||||
Timeout int `json:"timeout,omitempty" yaml:"timeout,omitempty"` // TODO: wait timeout in seconds for mobile action
|
||||
IgnoreNotFoundError bool `json:"ignore_NotFoundError,omitempty" yaml:"ignore_NotFoundError,omitempty"` // ignore error if target element not found
|
||||
@@ -90,13 +89,6 @@ func WithIndex(index int) ActionOption {
|
||||
}
|
||||
}
|
||||
|
||||
// WithFunction replaces params
|
||||
func WithFunction(function string) ActionOption {
|
||||
return func(o *MobileAction) {
|
||||
o.Function = function
|
||||
}
|
||||
}
|
||||
|
||||
// WithDirection inputs direction (up, down, left, right)
|
||||
func WithDirection(direction string) ActionOption {
|
||||
return func(o *MobileAction) {
|
||||
@@ -437,14 +429,17 @@ func (dExt *DriverExt) DoAction(action MobileAction) error {
|
||||
ACTION_SwipeToTapText, action.Params)
|
||||
case ACTION_SwipeToTapTexts:
|
||||
if texts, ok := action.Params.([]interface{}); ok {
|
||||
var textList []string
|
||||
for _, t := range texts {
|
||||
textList = append(textList, t.(string))
|
||||
}
|
||||
action.Params = textList
|
||||
}
|
||||
if texts, ok := action.Params.([]string); ok {
|
||||
var point PointF
|
||||
findText := func(d *DriverExt) error {
|
||||
var err error
|
||||
var ts []string
|
||||
for _, t := range texts {
|
||||
ts = append(ts, t.(string))
|
||||
}
|
||||
points, err := d.GetTextXYs(ts)
|
||||
points, err := d.GetTextXYs(texts)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user