refactor: TakeScreenShot saves all screenshots

This commit is contained in:
lilong.129
2023-04-16 22:11:35 +08:00
parent 3770ce12bd
commit 9e73328448
9 changed files with 50 additions and 72 deletions

View File

@@ -3,9 +3,10 @@ package adb
import (
"fmt"
"io/ioutil"
"time"
"github.com/spf13/cobra"
"github.com/httprunner/httprunner/v4/hrp/internal/builtin"
)
var screencapAndroidDevicesCmd = &cobra.Command{
@@ -22,7 +23,7 @@ var screencapAndroidDevicesCmd = &cobra.Command{
return err
}
filepath := fmt.Sprintf("screencap_%d.png", time.Now().Unix())
filepath := fmt.Sprintf("%s.png", builtin.GenNameWithTimestamp("screencap_"))
if err = ioutil.WriteFile(filepath, res, 0o644); err != nil {
return err
}