mirror of
https://github.com/httprunner/httprunner.git
synced 2026-06-02 14:29:44 +08:00
refactor: remove unused code
This commit is contained in:
@@ -60,18 +60,6 @@ type ScreenResult struct {
|
||||
Icons UIResultMap `json:"icons"` // CV 识别的图标
|
||||
Tags []string `json:"tags"` // tags for image, e.g. ["feed", "ad", "live"]
|
||||
Popup *PopupInfo `json:"popup,omitempty"`
|
||||
|
||||
SwipeStartTime int64 `json:"swipe_start_time"` // 滑动开始时间戳
|
||||
SwipeFinishTime int64 `json:"swipe_finish_time"` // 滑动结束时间戳
|
||||
FetchVideoStartTime int64 `json:"fetch_video_start_time"` // 抓取视频开始时间戳
|
||||
FetchVideoFinishTime int64 `json:"fetch_video_finish_time"` // 抓取视频结束时间戳
|
||||
|
||||
FetchVideoElapsed int64 `json:"fetch_video_elapsed"` // 抓取视频耗时(ms)
|
||||
ScreenshotTakeElapsed int64 `json:"screenshot_take_elapsed"` // 设备截图耗时(ms)
|
||||
ScreenshotCVElapsed int64 `json:"screenshot_cv_elapsed"` // CV 识别耗时(ms)
|
||||
|
||||
// 当前 Feed/Live 整体耗时
|
||||
TotalElapsed int64 `json:"total_elapsed"` // current_swipe_finish -> next_swipe_start 整体耗时(ms)
|
||||
}
|
||||
|
||||
type ScreenResultMap map[string]*ScreenResult // key is date time
|
||||
|
||||
@@ -71,12 +71,6 @@ func (dExt *DriverExt) AutoPopupHandler() error {
|
||||
return dExt.handleTextPopup(screenResult.Texts)
|
||||
}
|
||||
|
||||
const (
|
||||
CloseStatusFound = "found"
|
||||
CloseStatusSuccess = "success"
|
||||
CloseStatusFail = "fail"
|
||||
)
|
||||
|
||||
// ClosePopupsResult represents the result of recognized popup to close
|
||||
type ClosePopupsResult struct {
|
||||
Type string `json:"type"`
|
||||
@@ -87,9 +81,7 @@ type ClosePopupsResult struct {
|
||||
|
||||
type PopupInfo struct {
|
||||
*ClosePopupsResult
|
||||
CloseStatus string `json:"close_status"` // found/success/fail
|
||||
ClosePoints []PointF `json:"close_points,omitempty"` // CV 识别的所有关闭按钮(仅关闭按钮,可能存在多个)
|
||||
RetryCount int `json:"retry_count"`
|
||||
PicName string `json:"pic_name"`
|
||||
PicURL string `json:"pic_url"`
|
||||
}
|
||||
@@ -129,7 +121,6 @@ func (dExt *DriverExt) ClosePopupsHandler() (err error) {
|
||||
return nil
|
||||
}
|
||||
|
||||
popup.CloseStatus = CloseStatusFound
|
||||
log.Info().
|
||||
Interface("closePoint", closePoint).
|
||||
Interface("popup", popup).
|
||||
|
||||
@@ -386,7 +386,6 @@ type IImageService interface {
|
||||
|
||||
// GetScreenResult takes a screenshot, returns the image recognization result
|
||||
func (dExt *DriverExt) GetScreenResult(options ...ActionOption) (screenResult *ScreenResult, err error) {
|
||||
startTime := time.Now()
|
||||
fileName := builtin.GenNameWithTimestamp("%d_screenshot")
|
||||
actionOptions := NewActionOptions(options...)
|
||||
screenshotActions := actionOptions.screenshotActions()
|
||||
@@ -397,14 +396,12 @@ func (dExt *DriverExt) GetScreenResult(options ...ActionOption) (screenResult *S
|
||||
if err != nil {
|
||||
return
|
||||
}
|
||||
screenshotTakeElapsed := time.Since(startTime).Milliseconds()
|
||||
|
||||
screenResult = &ScreenResult{
|
||||
bufSource: bufSource,
|
||||
imagePath: imagePath,
|
||||
Tags: nil,
|
||||
Resolution: dExt.WindowSize,
|
||||
ScreenshotTakeElapsed: screenshotTakeElapsed,
|
||||
bufSource: bufSource,
|
||||
imagePath: imagePath,
|
||||
Tags: nil,
|
||||
Resolution: dExt.WindowSize,
|
||||
}
|
||||
|
||||
imageResult, err := dExt.ImageService.GetImage(bufSource, options...)
|
||||
@@ -414,7 +411,6 @@ func (dExt *DriverExt) GetScreenResult(options ...ActionOption) (screenResult *S
|
||||
}
|
||||
if imageResult != nil {
|
||||
screenResult.ImageResult = imageResult
|
||||
screenResult.ScreenshotCVElapsed = time.Since(startTime).Milliseconds() - screenshotTakeElapsed
|
||||
screenResult.Texts = imageResult.OCRResult.ToOCRTexts()
|
||||
screenResult.UploadedURL = imageResult.URL
|
||||
screenResult.Icons = imageResult.UIResult
|
||||
@@ -438,8 +434,6 @@ func (dExt *DriverExt) GetScreenResult(options ...ActionOption) (screenResult *S
|
||||
log.Debug().
|
||||
Str("imagePath", imagePath).
|
||||
Str("imageUrl", screenResult.UploadedURL).
|
||||
Int64("screenshot_take_elapsed(ms)", screenResult.ScreenshotTakeElapsed).
|
||||
Int64("screenshot_cv_elapsed(ms)", screenResult.ScreenshotCVElapsed).
|
||||
Msg("log screenshot")
|
||||
return screenResult, nil
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user