mirror of
https://github.com/httprunner/httprunner.git
synced 2026-07-12 16:01:27 +08:00
change: init android device
This commit is contained in:
@@ -1 +1 @@
|
|||||||
v5.0.0+2411051738
|
v5.0.0+2411072017
|
||||||
|
|||||||
@@ -37,17 +37,23 @@ func handleDeviceContext() gin.HandlerFunc {
|
|||||||
case "android":
|
case "android":
|
||||||
device, err := uixt.NewAndroidDevice(uixt.WithSerialNumber(serial), uixt.WithStub(true))
|
device, err := uixt.NewAndroidDevice(uixt.WithSerialNumber(serial), uixt.WithStub(true))
|
||||||
if err != nil {
|
if err != nil {
|
||||||
log.Error().Err(err).Str("platform", platform).Str("serial", serial).Msg(fmt.Sprintf("[%s]: Device Not Found", c.HandlerName()))
|
log.Error().Err(err).Str("platform", platform).Str("serial", serial).
|
||||||
c.JSON(http.StatusBadRequest, HttpResponse{
|
Msg("device not found")
|
||||||
Code: code.GetErrorCode(err),
|
c.JSON(http.StatusBadRequest,
|
||||||
Message: err.Error(),
|
HttpResponse{
|
||||||
})
|
Code: code.GetErrorCode(err),
|
||||||
|
Message: err.Error(),
|
||||||
|
},
|
||||||
|
)
|
||||||
c.Abort()
|
c.Abort()
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
device.Init()
|
||||||
|
|
||||||
driver, err := device.NewDriver(uixt.WithDriverImageService(true), uixt.WithDriverResultFolder(true))
|
driver, err := device.NewDriver(uixt.WithDriverImageService(true), uixt.WithDriverResultFolder(true))
|
||||||
if err != nil {
|
if err != nil {
|
||||||
log.Error().Err(err).Str("platform", platform).Str("serial", serial).Msg(fmt.Sprintf("[%s]: Failed New Driver", c.HandlerName()))
|
log.Error().Err(err).Str("platform", platform).Str("serial", serial).
|
||||||
|
Msg("failed to init driver")
|
||||||
c.JSON(http.StatusInternalServerError,
|
c.JSON(http.StatusInternalServerError,
|
||||||
HttpResponse{
|
HttpResponse{
|
||||||
Code: code.GetErrorCode(err),
|
Code: code.GetErrorCode(err),
|
||||||
|
|||||||
Reference in New Issue
Block a user