mirror of
https://github.com/httprunner/httprunner.git
synced 2026-06-06 00:09:37 +08:00
refactor: rename env package to config
This commit is contained in:
@@ -19,7 +19,7 @@ import (
|
||||
"github.com/rs/zerolog/log"
|
||||
|
||||
"github.com/httprunner/httprunner/v4/hrp/code"
|
||||
"github.com/httprunner/httprunner/v4/hrp/internal/env"
|
||||
"github.com/httprunner/httprunner/v4/hrp/internal/config"
|
||||
"github.com/httprunner/httprunner/v4/hrp/pkg/gadb"
|
||||
"github.com/httprunner/httprunner/v4/hrp/pkg/utf7"
|
||||
)
|
||||
@@ -699,10 +699,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", env.ActionLogFilePath)
|
||||
logFilePathPrefix := fmt.Sprintf("%v/data", config.ActionLogFilePath)
|
||||
files := []string{}
|
||||
myexec.RunCommand("adb", "-s", ad.adbClient.Serial(), "pull", env.DeviceActionLogFilePath, env.ActionLogFilePath)
|
||||
err = filepath.Walk(env.ActionLogFilePath, func(path string, info fs.FileInfo, err error) error {
|
||||
myexec.RunCommand("adb", "-s", ad.adbClient.Serial(), "pull", config.DeviceActionLogFilePath, config.ActionLogFilePath)
|
||||
err = filepath.Walk(config.ActionLogFilePath, func(path string, info fs.FileInfo, err error) error {
|
||||
// 只是需要日志文件
|
||||
if ok := strings.Contains(path, logFilePathPrefix); ok {
|
||||
files = append(files, path)
|
||||
|
||||
@@ -23,7 +23,7 @@ import (
|
||||
|
||||
"github.com/httprunner/httprunner/v4/hrp/code"
|
||||
"github.com/httprunner/httprunner/v4/hrp/internal/builtin"
|
||||
"github.com/httprunner/httprunner/v4/hrp/internal/env"
|
||||
"github.com/httprunner/httprunner/v4/hrp/internal/config"
|
||||
"github.com/httprunner/httprunner/v4/hrp/internal/json"
|
||||
"github.com/httprunner/httprunner/v4/hrp/pkg/gadb"
|
||||
)
|
||||
@@ -195,7 +195,7 @@ type AndroidDevice struct {
|
||||
|
||||
func (dev *AndroidDevice) Init() error {
|
||||
dev.d.RunShellCommand("ime", "enable", "io.appium.settings/.UnicodeIME")
|
||||
dev.d.RunShellCommand("rm", "-r", env.DeviceActionLogFilePath)
|
||||
dev.d.RunShellCommand("rm", "-r", config.DeviceActionLogFilePath)
|
||||
|
||||
if dev.UIA2 {
|
||||
// uiautomator2 server must be started before
|
||||
|
||||
@@ -10,7 +10,7 @@ import (
|
||||
"github.com/rs/zerolog/log"
|
||||
|
||||
"github.com/httprunner/httprunner/v4/hrp/internal/builtin"
|
||||
"github.com/httprunner/httprunner/v4/hrp/internal/env"
|
||||
"github.com/httprunner/httprunner/v4/hrp/internal/config"
|
||||
)
|
||||
|
||||
type DriverExt struct {
|
||||
@@ -42,10 +42,10 @@ func newDriverExt(device IDevice, driver IWebDriver, options ...DriverOption) (d
|
||||
}
|
||||
if driverOptions.withResultFolder {
|
||||
// create results directory
|
||||
if err = builtin.EnsureFolderExists(env.ResultsPath); err != nil {
|
||||
if err = builtin.EnsureFolderExists(config.ResultsPath); err != nil {
|
||||
return nil, errors.Wrap(err, "create results directory failed")
|
||||
}
|
||||
if err = builtin.EnsureFolderExists(env.ScreenShotsPath); err != nil {
|
||||
if err = builtin.EnsureFolderExists(config.ScreenShotsPath); err != nil {
|
||||
return nil, errors.Wrap(err, "create screenshots directory failed")
|
||||
}
|
||||
}
|
||||
|
||||
@@ -19,7 +19,7 @@ import (
|
||||
|
||||
"github.com/httprunner/httprunner/v4/hrp/code"
|
||||
"github.com/httprunner/httprunner/v4/hrp/internal/builtin"
|
||||
"github.com/httprunner/httprunner/v4/hrp/internal/env"
|
||||
"github.com/httprunner/httprunner/v4/hrp/internal/config"
|
||||
"github.com/httprunner/httprunner/v4/hrp/pkg/gidevice"
|
||||
)
|
||||
|
||||
@@ -383,7 +383,7 @@ func (dev *IOSDevice) StartPerf() error {
|
||||
return err
|
||||
}
|
||||
|
||||
dev.perfFile = filepath.Join(env.ResultsPath, "perf.data")
|
||||
dev.perfFile = filepath.Join(config.ResultsPath, "perf.data")
|
||||
file, err := os.OpenFile(dev.perfFile,
|
||||
os.O_CREATE|os.O_RDWR|os.O_TRUNC, 0o755)
|
||||
if err != nil {
|
||||
@@ -428,7 +428,7 @@ func (dev *IOSDevice) StartPcap() error {
|
||||
return err
|
||||
}
|
||||
|
||||
dev.pcapFile = filepath.Join(env.ResultsPath, "dump.pcap")
|
||||
dev.pcapFile = filepath.Join(config.ResultsPath, "dump.pcap")
|
||||
file, err := os.OpenFile(dev.pcapFile,
|
||||
os.O_CREATE|os.O_RDWR|os.O_TRUNC, 0o755)
|
||||
if err != nil {
|
||||
|
||||
@@ -16,7 +16,7 @@ import (
|
||||
|
||||
"github.com/httprunner/httprunner/v4/hrp/code"
|
||||
"github.com/httprunner/httprunner/v4/hrp/internal/builtin"
|
||||
"github.com/httprunner/httprunner/v4/hrp/internal/env"
|
||||
"github.com/httprunner/httprunner/v4/hrp/internal/config"
|
||||
)
|
||||
|
||||
type ScreenResult struct {
|
||||
@@ -181,7 +181,7 @@ func (dExt *DriverExt) GetScreenShot(fileName string) (raw *bytes.Buffer, path s
|
||||
}
|
||||
|
||||
// save screenshot to file
|
||||
path = filepath.Join(env.ScreenShotsPath, fileName)
|
||||
path = filepath.Join(config.ScreenShotsPath, fileName)
|
||||
path, err = saveScreenShot(raw, path)
|
||||
if err != nil {
|
||||
log.Error().Err(err).Msg("save screenshot file failed")
|
||||
|
||||
Reference in New Issue
Block a user