mirror of
https://github.com/httprunner/httprunner.git
synced 2026-05-30 12:59:39 +08:00
refactor: TakeScreenShot saves all screenshots
This commit is contained in:
@@ -2,7 +2,6 @@ package uixt
|
||||
|
||||
import (
|
||||
"bytes"
|
||||
"fmt"
|
||||
"math"
|
||||
"strings"
|
||||
"time"
|
||||
@@ -437,7 +436,6 @@ type DataOptions struct {
|
||||
IgnoreNotFoundError bool // ignore error if target element not found
|
||||
MaxRetryTimes int // max retry times if target element not found
|
||||
Interval float64 // interval between retries in seconds
|
||||
ScreenShotFilename string // turn on screenshot and specify file name
|
||||
}
|
||||
|
||||
type DataOption func(data *DataOptions)
|
||||
@@ -514,16 +512,6 @@ func WithDataWaitTime(sec float64) DataOption {
|
||||
}
|
||||
}
|
||||
|
||||
func WithScreenShot(fileName ...string) DataOption {
|
||||
return func(data *DataOptions) {
|
||||
if len(fileName) > 0 {
|
||||
data.ScreenShotFilename = fileName[0]
|
||||
} else {
|
||||
data.ScreenShotFilename = fmt.Sprintf("screenshot_%d", time.Now().Unix())
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
func NewDataOptions(options ...DataOption) *DataOptions {
|
||||
dataOptions := &DataOptions{
|
||||
Data: make(map[string]interface{}),
|
||||
|
||||
Reference in New Issue
Block a user