feat: SwipeToTapApp, SwipeToTapText

This commit is contained in:
debugtalk
2022-08-31 21:21:55 +08:00
parent 9b547524d2
commit 70aa8fa937
3 changed files with 138 additions and 2 deletions

View File

@@ -49,18 +49,29 @@ const (
uiSelectorImage string = "ui_image"
assertionExists string = "exists"
assertionNotExists string = "not_exists"
// custom actions
swipeToTapApp MobileMethod = "swipe_to_tap_app" // swipe left & right to find app and tap
swipeToTapText MobileMethod = "swipe_to_tap_text" // swipe up & down to find text and tap
)
type MobileAction struct {
Method MobileMethod `json:"method" yaml:"method"`
Params interface{} `json:"params,omitempty" yaml:"params,omitempty"`
maxRetryTimes int // max retry times
timeout int // TODO: wait timeout in seconds for mobile action
ignoreNotFoundError bool // ignore error if target element not found
}
type ActionOption func(o *MobileAction)
func WithMaxRetryTimes(maxRetryTimes int) ActionOption {
return func(o *MobileAction) {
o.maxRetryTimes = maxRetryTimes
}
}
func WithTimeout(timeout int) ActionOption {
return func(o *MobileAction) {
o.timeout = timeout