change: update NewData function

This commit is contained in:
xucong.053
2022-10-17 15:28:46 +08:00
parent 0e248882b1
commit 317ec4fde8
7 changed files with 17 additions and 37 deletions

View File

@@ -837,9 +837,9 @@ type DataOptions struct {
IgnoreNotFoundError bool // ignore error if target element not found
}
func NewData(options ...DataOption) *DataOptions {
func NewData(d map[string]interface{}, options ...DataOption) *DataOptions {
data := &DataOptions{
Data: map[string]interface{}{},
Data: d,
}
for _, option := range options {
option(data)
@@ -868,16 +868,6 @@ func NewData(options ...DataOption) *DataOptions {
return data
}
func (d *DataOptions) MergeData(data map[string]interface{}) {
for key, value := range data {
d.Data[key] = value
}
}
func (d *DataOptions) AddData(key string, value interface{}) {
d.Data[key] = value
}
// current implemeted device: IOSDevice, AndroidDevice
type Device interface {
UUID() string