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