mirror of
https://github.com/httprunner/httprunner.git
synced 2026-05-18 05:27:36 +08:00
refactor: move action options to pkg/uixt/options/action
This commit is contained in:
@@ -1,6 +1,8 @@
|
||||
package server
|
||||
|
||||
import "github.com/httprunner/httprunner/v5/pkg/uixt"
|
||||
import (
|
||||
"github.com/httprunner/httprunner/v5/pkg/uixt/options"
|
||||
)
|
||||
|
||||
type HttpResponse struct {
|
||||
Code int `json:"code"`
|
||||
@@ -13,7 +15,7 @@ type TapRequest struct {
|
||||
Y float64 `json:"y"`
|
||||
Text string `json:"text"`
|
||||
|
||||
Options *uixt.ActionOptions `json:"options,omitempty"`
|
||||
Options *options.ActionOptions `json:"options,omitempty"`
|
||||
}
|
||||
|
||||
type DragRequest struct {
|
||||
@@ -22,7 +24,7 @@ type DragRequest struct {
|
||||
ToX float64 `json:"to_x"`
|
||||
ToY float64 `json:"to_y"`
|
||||
|
||||
Options *uixt.ActionOptions `json:"options,omitempty"`
|
||||
Options *options.ActionOptions `json:"options,omitempty"`
|
||||
}
|
||||
|
||||
type InputRequest struct {
|
||||
@@ -31,7 +33,7 @@ type InputRequest struct {
|
||||
}
|
||||
|
||||
type ScreenRequest struct {
|
||||
Options *uixt.ActionOptions `json:"options,omitempty"`
|
||||
Options *options.ActionOptions `json:"options,omitempty"`
|
||||
}
|
||||
|
||||
type KeycodeRequest struct {
|
||||
|
||||
@@ -8,6 +8,7 @@ import (
|
||||
"github.com/gin-gonic/gin"
|
||||
"github.com/httprunner/httprunner/v5/code"
|
||||
"github.com/httprunner/httprunner/v5/pkg/uixt"
|
||||
"github.com/httprunner/httprunner/v5/pkg/uixt/options"
|
||||
"github.com/rs/zerolog/log"
|
||||
)
|
||||
|
||||
@@ -51,7 +52,7 @@ func screenResultHandler(c *gin.Context) {
|
||||
return
|
||||
}
|
||||
|
||||
var actionOptions []uixt.ActionOption
|
||||
var actionOptions []options.ActionOption
|
||||
if screenReq.Options != nil {
|
||||
actionOptions = screenReq.Options.Options()
|
||||
}
|
||||
|
||||
@@ -6,7 +6,7 @@ import (
|
||||
|
||||
"github.com/gin-gonic/gin"
|
||||
"github.com/httprunner/httprunner/v5/code"
|
||||
"github.com/httprunner/httprunner/v5/pkg/uixt"
|
||||
"github.com/httprunner/httprunner/v5/pkg/uixt/options"
|
||||
"github.com/rs/zerolog/log"
|
||||
)
|
||||
|
||||
@@ -22,7 +22,7 @@ func tapHandler(c *gin.Context) {
|
||||
return
|
||||
}
|
||||
|
||||
var actionOptions []uixt.ActionOption
|
||||
var actionOptions []options.ActionOption
|
||||
if tapReq.Options != nil {
|
||||
actionOptions = tapReq.Options.Options()
|
||||
}
|
||||
@@ -82,7 +82,7 @@ func dragHandler(c *gin.Context) {
|
||||
return
|
||||
}
|
||||
|
||||
var actionOptions []uixt.ActionOption
|
||||
var actionOptions []options.ActionOption
|
||||
if dragReq.Options != nil {
|
||||
actionOptions = dragReq.Options.Options()
|
||||
}
|
||||
@@ -139,7 +139,8 @@ func inputHandler(c *gin.Context) {
|
||||
return
|
||||
}
|
||||
|
||||
err = dExt.Driver.SendKeys(inputReq.Text, uixt.WithFrequency(inputReq.Frequency))
|
||||
err = dExt.Driver.SendKeys(inputReq.Text,
|
||||
options.WithFrequency(inputReq.Frequency))
|
||||
if err != nil {
|
||||
log.Err(err).Msg(fmt.Sprintf("[%s]: failed to input text %s", c.HandlerName(), inputReq.Text))
|
||||
c.JSON(http.StatusInternalServerError,
|
||||
|
||||
Reference in New Issue
Block a user