diff --git a/internal/version/VERSION b/internal/version/VERSION index 9066599a..43e8ef92 100644 --- a/internal/version/VERSION +++ b/internal/version/VERSION @@ -1 +1 @@ -v5.0.0-250701 +v5.0.0-250702 diff --git a/uixt/driver_ext_swipe.go b/uixt/driver_ext_swipe.go index bbfa3f37..cfbda133 100644 --- a/uixt/driver_ext_swipe.go +++ b/uixt/driver_ext_swipe.go @@ -98,9 +98,6 @@ func (dExt *XTDriver) SwipeToTapTexts(texts []string, opts ...option.ActionOptio log.Info().Strs("texts", texts).Msg("swipe to tap texts") opts = append(opts, option.WithMatchOne(true), option.WithRegex(true)) - actionOptions := option.NewActionOptions(opts...) - actionOptions.Identifier = "" - optionsWithoutIdentifier := actionOptions.Options() var point ai.PointF findTexts := func(d *XTDriver) error { var err error @@ -116,7 +113,7 @@ func (dExt *XTDriver) SwipeToTapTexts(texts []string, opts ...option.ActionOptio } points, err := screenResult.Texts.FindTexts(texts, - convertToAbsoluteScope(dExt.IDriver, optionsWithoutIdentifier...)...) + convertToAbsoluteScope(dExt.IDriver, opts...)...) if err != nil { log.Error().Err(err).Strs("texts", texts).Msg("find texts failed") return err @@ -132,8 +129,8 @@ func (dExt *XTDriver) SwipeToTapTexts(texts []string, opts ...option.ActionOptio return d.TapAbsXY(point.X, point.Y, opts...) } - findAction := prepareSwipeAction(dExt, nil, optionsWithoutIdentifier...) - return dExt.LoopUntil(findAction, findTexts, foundTextAction, optionsWithoutIdentifier...) + findAction := prepareSwipeAction(dExt, nil, opts...) + return dExt.LoopUntil(findAction, findTexts, foundTextAction, opts...) } func (dExt *XTDriver) SwipeToTapApp(appName string, opts ...option.ActionOption) error { @@ -160,7 +157,7 @@ func (dExt *XTDriver) SwipeToTapApp(appName string, opts ...option.ActionOption) actionOptions := option.NewActionOptions(opts...) // tap app icon above the text if len(actionOptions.TapOffset) == 0 { - opts = append(opts, option.WithTapOffset(0, -25)) + opts = append(opts, option.WithTapOffset(0, -100)) } // set default swipe interval to 1 second if builtin.IsZeroFloat64(actionOptions.Interval) { diff --git a/uixt/driver_ext_test.go b/uixt/driver_ext_test.go index 112139dc..88b34c92 100644 --- a/uixt/driver_ext_test.go +++ b/uixt/driver_ext_test.go @@ -9,9 +9,10 @@ import ( "testing" "time" - "github.com/httprunner/httprunner/v5/uixt/option" "github.com/stretchr/testify/assert" "github.com/stretchr/testify/require" + + "github.com/httprunner/httprunner/v5/uixt/option" ) func TestDriverExt_NewMethod1(t *testing.T) { @@ -142,7 +143,7 @@ func TestDriverExt_prepareSwipeAction(t *testing.T) { func TestDriverExt_SwipeToTapApp(t *testing.T) { driver := setupDriverExt(t) - err := driver.SwipeToTapApp("抖音") + err := driver.SwipeToTapApp("抖音", option.WithPreMarkOperation(true)) assert.Nil(t, err) } diff --git a/uixt/mcp_tools_swipe.go b/uixt/mcp_tools_swipe.go index d624da7f..eaa1a0d6 100644 --- a/uixt/mcp_tools_swipe.go +++ b/uixt/mcp_tools_swipe.go @@ -319,19 +319,6 @@ func (t *ToolSwipeToTapApp) Implement() server.ToolHandlerFunc { // Build action options from request structure opts := unifiedReq.Options() - // Add boolean options - if unifiedReq.IgnoreNotFoundError { - opts = append(opts, option.WithIgnoreNotFoundError(true)) - } - - // Add numeric options - if unifiedReq.MaxRetryTimes > 0 { - opts = append(opts, option.WithMaxRetryTimes(unifiedReq.MaxRetryTimes)) - } - if unifiedReq.Index > 0 { - opts = append(opts, option.WithIndex(unifiedReq.Index)) - } - // Swipe to tap app action logic err = driverExt.SwipeToTapApp(unifiedReq.AppName, opts...) if err != nil {