change: set closeResult nil to reduce unnecessary summary info

This commit is contained in:
lilong.129
2024-11-12 22:29:39 +08:00
parent 11893aa5c1
commit 589b18f9f0
4 changed files with 21 additions and 12 deletions

View File

@@ -1 +1 @@
v5.0.0+2411112311
v5.0.0+2411122229

View File

@@ -543,7 +543,7 @@ func (dExt *DriverExt) GenAbsScope(x1, y1, x2, y2 float64) AbsScope {
}
func (dExt *DriverExt) DoAction(action MobileAction) (err error) {
log.Debug().
log.Info().
Str("method", string(action.Method)).
Interface("params", action.Params).
Msg("uixt action start")
@@ -557,7 +557,7 @@ func (dExt *DriverExt) DoAction(action MobileAction) (err error) {
Int64("elapsed(ms)", time.Since(actionStartTime).Milliseconds()).
Msg("uixt action end")
} else {
log.Debug().
log.Info().
Str("method", string(action.Method)).
Interface("params", action.Params).
Int64("elapsed(ms)", time.Since(actionStartTime).Milliseconds()).

View File

@@ -283,3 +283,7 @@ type ClosePopupsResult struct {
CloseArea Box `json:"closeArea"`
Text string `json:"text"`
}
func (c ClosePopupsResult) IsEmpty() bool {
return c.PopupArea.IsEmpty() && c.CloseArea.IsEmpty()
}

View File

@@ -90,23 +90,28 @@ func (dExt *DriverExt) GetScreenResult(options ...ActionOption) (screenResult *S
dExt.Driver.GetSession().addScreenResult(screenResult)
if imageResult != nil {
screenResult.ImageResult = imageResult
screenResult.Texts = imageResult.OCRResult.ToOCRTexts()
screenResult.UploadedURL = imageResult.URL
screenResult.Icons = imageResult.UIResult
if actionOptions.ScreenShotWithClosePopups && imageResult.ClosePopupsResult != nil {
screenResult.Popup = &PopupInfo{
ClosePopupsResult: imageResult.ClosePopupsResult,
PicName: imagePath,
PicURL: imageResult.URL,
}
if imageResult.ClosePopupsResult.IsEmpty() {
// set nil to reduce unnecessary summary info
imageResult.ClosePopupsResult = nil
} else {
screenResult.Popup = &PopupInfo{
ClosePopupsResult: imageResult.ClosePopupsResult,
PicName: imagePath,
PicURL: imageResult.URL,
}
closeAreas, _ := imageResult.UIResult.FilterUIResults([]string{"close"})
for _, closeArea := range closeAreas {
screenResult.Popup.ClosePoints = append(screenResult.Popup.ClosePoints, closeArea.Center())
closeAreas, _ := imageResult.UIResult.FilterUIResults([]string{"close"})
for _, closeArea := range closeAreas {
screenResult.Popup.ClosePoints = append(screenResult.Popup.ClosePoints, closeArea.Center())
}
}
}
screenResult.ImageResult = imageResult
}
log.Debug().