mirror of
https://github.com/httprunner/httprunner.git
synced 2026-05-11 18:11:21 +08:00
fix: get config
This commit is contained in:
@@ -100,7 +100,7 @@ type AndroidDevice struct {
|
||||
|
||||
func (dev *AndroidDevice) Setup() error {
|
||||
dev.Device.RunShellCommand("ime", "enable", option.UnicodeImePackageName)
|
||||
dev.Device.RunShellCommand("rm", "-r", config.DeviceActionLogFilePath)
|
||||
dev.Device.RunShellCommand("rm", "-r", config.GetConfig().DeviceActionLogFilePath)
|
||||
|
||||
// setup evalite
|
||||
evalToolRaw, err := evalite.ReadFile("evalite")
|
||||
|
||||
@@ -677,10 +677,10 @@ func (ad *ADBDriver) StopCaptureLog() (result interface{}, err error) {
|
||||
// 没有解析到打点日志,走兜底逻辑
|
||||
if len(pointRes) == 0 {
|
||||
log.Info().Msg("action log is null, use action file >>>")
|
||||
logFilePathPrefix := fmt.Sprintf("%v/data", config.ActionLogFilePath)
|
||||
logFilePathPrefix := fmt.Sprintf("%v/data", config.GetConfig().ActionLogFilePath)
|
||||
files := []string{}
|
||||
ad.Device.RunShellCommand("pull", config.DeviceActionLogFilePath, config.ActionLogFilePath)
|
||||
err = filepath.Walk(config.ActionLogFilePath, func(path string, info fs.FileInfo, err error) error {
|
||||
ad.Device.RunShellCommand("pull", config.GetConfig().DeviceActionLogFilePath, config.GetConfig().ActionLogFilePath)
|
||||
err = filepath.Walk(config.GetConfig().ActionLogFilePath, func(path string, info fs.FileInfo, err error) error {
|
||||
// 只是需要日志文件
|
||||
if ok := strings.Contains(path, logFilePathPrefix); ok {
|
||||
files = append(files, path)
|
||||
@@ -800,7 +800,7 @@ func (ad *ADBDriver) GetIme() (ime string, err error) {
|
||||
|
||||
func (ad *ADBDriver) ScreenRecord(duration time.Duration) (videoPath string, err error) {
|
||||
timestamp := time.Now().Format("20060102_150405") + fmt.Sprintf("_%03d", time.Now().UnixNano()/1e6%1000)
|
||||
fileName := filepath.Join(config.ScreenShotsPath, fmt.Sprintf("%s.mp4", timestamp))
|
||||
fileName := filepath.Join(config.GetConfig().ScreenShotsPath, fmt.Sprintf("%s.mp4", timestamp))
|
||||
|
||||
file, err := os.Create(fileName)
|
||||
if err != nil {
|
||||
|
||||
@@ -68,7 +68,7 @@ func (dExt *XTDriver) GetScreenResult(opts ...option.ActionOption) (screenResult
|
||||
|
||||
// get screenshot info with retry
|
||||
for i := 0; i < 3; i++ {
|
||||
imagePath = filepath.Join(config.ScreenShotsPath, fileName)
|
||||
imagePath = filepath.Join(config.GetConfig().ScreenShotsPath, fileName)
|
||||
bufSource, err = dExt.ScreenShot()
|
||||
if err != nil {
|
||||
lastErr = err
|
||||
|
||||
@@ -276,7 +276,7 @@ var (
|
||||
func DownloadFileByUrl(fileUrl string) (filePath string, err error) {
|
||||
hash := md5.Sum([]byte(fileUrl))
|
||||
fileName := fmt.Sprintf("%x", hash)
|
||||
filePath = filepath.Join(config.DownloadsPath, fileName)
|
||||
filePath = filepath.Join(config.GetConfig().DownloadsPath, fileName)
|
||||
|
||||
// get or create file lock
|
||||
lockI, _ := fileLocks.LoadOrStore(filePath, &sync.Mutex{})
|
||||
|
||||
@@ -894,7 +894,7 @@ func (wd *WDADriver) triggerWDALog(data map[string]interface{}) (rawResp []byte,
|
||||
|
||||
func (wd *WDADriver) ScreenRecord(duration time.Duration) (videoPath string, err error) {
|
||||
timestamp := time.Now().Format("20060102_150405") + fmt.Sprintf("_%03d", time.Now().UnixNano()/1e6%1000)
|
||||
fileName := filepath.Join(config.ScreenShotsPath, fmt.Sprintf("%s.mp4", timestamp))
|
||||
fileName := filepath.Join(config.GetConfig().ScreenShotsPath, fmt.Sprintf("%s.mp4", timestamp))
|
||||
|
||||
file, err := os.Create(fileName)
|
||||
if err != nil {
|
||||
|
||||
Reference in New Issue
Block a user