mirror of
https://github.com/httprunner/httprunner.git
synced 2026-05-11 18:11:21 +08:00
- Move MobileAction struct from uixt package to uixt/option package - Delete uixt/driver_action.go file as MobileAction is now in option package - Update all import statements across the codebase to use option.MobileAction - Update ActionTool interface to use option.MobileAction in ConvertActionToCallToolRequest method - Maintain backward compatibility while improving package organization - Clean up code structure by consolidating action-related types in option package Files affected: - server/uixt.go: Updated imports and type references - step.go: Updated imports and ActionResult struct - step_ui.go: Updated all MobileAction references to option.MobileAction - uixt/mcp_server.go: Updated ActionTool interface and removed detailed comments - uixt/mcp_server_test.go: Updated all test cases to use option.MobileAction - uixt/mcp_tools_*.go: Updated ConvertActionToCallToolRequest method signatures - uixt/option/action.go: Added MobileAction struct definition - uixt/sdk.go: Updated ExecuteAction method signature
54 lines
1.1 KiB
Go
54 lines
1.1 KiB
Go
package server
|
|
|
|
import (
|
|
"github.com/gin-gonic/gin"
|
|
"github.com/httprunner/httprunner/v5/uixt/option"
|
|
"github.com/rs/zerolog/log"
|
|
)
|
|
|
|
// exec a single uixt action
|
|
func (r *Router) uixtActionHandler(c *gin.Context) {
|
|
dExt, err := r.GetDriver(c)
|
|
if err != nil {
|
|
return
|
|
}
|
|
|
|
var req option.MobileAction
|
|
if err := c.ShouldBindJSON(&req); err != nil {
|
|
RenderErrorValidateRequest(c, err)
|
|
return
|
|
}
|
|
|
|
if err = dExt.ExecuteAction(c.Request.Context(), req); err != nil {
|
|
log.Err(err).Interface("action", req).
|
|
Msg("exec uixt action failed")
|
|
RenderError(c, err)
|
|
return
|
|
}
|
|
RenderSuccess(c, true)
|
|
}
|
|
|
|
// exec multiple uixt actions
|
|
func (r *Router) uixtActionsHandler(c *gin.Context) {
|
|
dExt, err := r.GetDriver(c)
|
|
if err != nil {
|
|
return
|
|
}
|
|
|
|
var actions []option.MobileAction
|
|
if err := c.ShouldBindJSON(&actions); err != nil {
|
|
RenderErrorValidateRequest(c, err)
|
|
return
|
|
}
|
|
|
|
for _, action := range actions {
|
|
if err = dExt.ExecuteAction(c.Request.Context(), action); err != nil {
|
|
log.Err(err).Interface("action", action).
|
|
Msg("exec uixt action failed")
|
|
RenderError(c, err)
|
|
return
|
|
}
|
|
}
|
|
RenderSuccess(c, true)
|
|
}
|