mirror of
https://github.com/httprunner/httprunner.git
synced 2026-05-12 02:21:29 +08:00
feat: save video stat to summary
This commit is contained in:
@@ -50,6 +50,8 @@ type cacheStepData struct {
|
||||
ScreenShots []string
|
||||
// cache step screenshot ocr results, key is image path, value is dumped OCRTexts
|
||||
OcrResults map[string]string
|
||||
// cache feed/live video stat
|
||||
VideoStat *VideoStat
|
||||
}
|
||||
|
||||
type DriverExt struct {
|
||||
|
||||
@@ -130,13 +130,17 @@ func (l *LiveCrawler) exitLiveRoom() error {
|
||||
}
|
||||
|
||||
func (dExt *DriverExt) VideoCrawler(configs *VideoCrawlerConfigs) (err error) {
|
||||
currVideoStat := &VideoStat{}
|
||||
defer func() {
|
||||
dExt.cacheStepData.VideoStat = currVideoStat
|
||||
}()
|
||||
|
||||
// launch app
|
||||
if err = dExt.Driver.AppLaunch(configs.AppPackageName); err != nil {
|
||||
return err
|
||||
}
|
||||
time.Sleep(5 * time.Second)
|
||||
|
||||
currVideoStat := &VideoStat{}
|
||||
liveCrawler := LiveCrawler{
|
||||
driver: dExt,
|
||||
configs: configs,
|
||||
|
||||
@@ -619,6 +619,7 @@ func runStepMobileUI(s *SessionRunner, step *TStep) (stepResult *StepResult, err
|
||||
cacheData := uiDriver.GetStepCacheData()
|
||||
attachments["screenshots"] = cacheData.ScreenShots
|
||||
attachments["ocr_results"] = cacheData.OcrResults
|
||||
attachments["video_stat"] = cacheData.VideoStat
|
||||
stepResult.Attachments = attachments
|
||||
}()
|
||||
|
||||
|
||||
Reference in New Issue
Block a user