mirror of
https://github.com/httprunner/httprunner.git
synced 2026-08-25 01:59:52 +08:00
feat: get feed simulation play duration
This commit is contained in:
@@ -1,7 +1,6 @@
|
|||||||
package convert
|
package convert
|
||||||
|
|
||||||
import (
|
import (
|
||||||
_ "embed"
|
|
||||||
"path/filepath"
|
"path/filepath"
|
||||||
"time"
|
"time"
|
||||||
|
|
||||||
|
|||||||
@@ -231,6 +231,12 @@ func (dExt *DriverExt) GetStepCacheData() map[string]interface{} {
|
|||||||
"width": screenSize.Width,
|
"width": screenSize.Width,
|
||||||
"height": screenSize.Height,
|
"height": screenSize.Height,
|
||||||
},
|
},
|
||||||
|
"video_type": screenResult.VideoType,
|
||||||
|
"feed": screenResult.Feed,
|
||||||
|
"live": screenResult.Live,
|
||||||
|
"swipe_start_time": screenResult.SwipeStartTime,
|
||||||
|
"swipe_finish_time": screenResult.SwipeFinishTime,
|
||||||
|
"elapsed": screenResult.Elapsed,
|
||||||
}
|
}
|
||||||
|
|
||||||
screenResults[imagePath] = data
|
screenResults[imagePath] = data
|
||||||
|
|||||||
@@ -367,8 +367,7 @@ func (dExt *DriverExt) GetScreenResult() (screenResult *ScreenResult, err error)
|
|||||||
Texts: imageResult.OCRResult.ToOCRTexts(),
|
Texts: imageResult.OCRResult.ToOCRTexts(),
|
||||||
Tags: nil,
|
Tags: nil,
|
||||||
}
|
}
|
||||||
if imageResult.LiveType != "" {
|
if imageResult.LiveType != "" && imageResult.LiveType != "NoLive" {
|
||||||
screenResult.VideoType = "live"
|
|
||||||
screenResult.Live = &LiveRoom{
|
screenResult.Live = &LiveRoom{
|
||||||
LiveType: imageResult.LiveType,
|
LiveType: imageResult.LiveType,
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -127,8 +127,11 @@ func (s *VideoStat) incrFeed(screenResult *ScreenResult, driverExt *DriverExt) e
|
|||||||
}
|
}
|
||||||
|
|
||||||
// get simulation play duration
|
// get simulation play duration
|
||||||
if screenResult.Feed.PlayDuration == 0 {
|
if screenResult.Feed.SimulationPlayDuration != 0 {
|
||||||
screenResult.Feed.PlayDuration = getSimulationDuration(s.configs.Feed.SleepRandom)
|
screenResult.Feed.PlayDuration = screenResult.Feed.SimulationPlayDuration
|
||||||
|
} else {
|
||||||
|
screenResult.Feed.RandomPlayDuration = getSimulationDuration(s.configs.Feed.SleepRandom)
|
||||||
|
screenResult.Feed.PlayDuration = screenResult.Feed.RandomPlayDuration
|
||||||
}
|
}
|
||||||
|
|
||||||
log.Info().Strs("tags", screenResult.Tags).
|
log.Info().Strs("tags", screenResult.Tags).
|
||||||
@@ -475,6 +478,7 @@ type FeedVideo struct {
|
|||||||
UserName string `json:"user_name"` // 视频作者
|
UserName string `json:"user_name"` // 视频作者
|
||||||
Duration int64 `json:"duration"` // 视频时长(ms)
|
Duration int64 `json:"duration"` // 视频时长(ms)
|
||||||
Caption string `json:"caption"` // 视频文案
|
Caption string `json:"caption"` // 视频文案
|
||||||
|
|
||||||
// 视频热度数据
|
// 视频热度数据
|
||||||
ViewCount int64 `json:"view_count"` // feed 观看数
|
ViewCount int64 `json:"view_count"` // feed 观看数
|
||||||
LikeCount int64 `json:"like_count"` // feed 点赞数
|
LikeCount int64 `json:"like_count"` // feed 点赞数
|
||||||
@@ -482,8 +486,11 @@ type FeedVideo struct {
|
|||||||
CollectCount int64 `json:"collect_count"` // feed 收藏数
|
CollectCount int64 `json:"collect_count"` // feed 收藏数
|
||||||
ForwardCount int64 `json:"forward_count"` // feed 转发数
|
ForwardCount int64 `json:"forward_count"` // feed 转发数
|
||||||
ShareCount int64 `json:"share_count"` // feed 分享数
|
ShareCount int64 `json:"share_count"` // feed 分享数
|
||||||
|
|
||||||
// 记录仿真决策信息
|
// 记录仿真决策信息
|
||||||
PlayDuration int64 `json:"play_duration"` // 播放时长(ms)
|
PlayDuration int64 `json:"play_duration"` // 播放时长(ms),取自 Simulation/Random
|
||||||
|
SimulationPlayDuration int64 `json:"simulation_play_duration"` // 仿真播放时长(ms)
|
||||||
|
RandomPlayDuration int64 `json:"random_play_duration"` // 随机播放时长(ms)
|
||||||
|
|
||||||
// timelines
|
// timelines
|
||||||
PreloadTimestamp int64 `json:"preload_timestamp"` // 预加载时间戳
|
PreloadTimestamp int64 `json:"preload_timestamp"` // 预加载时间戳
|
||||||
|
|||||||
Reference in New Issue
Block a user