mirror of
https://github.com/httprunner/httprunner.git
synced 2026-06-05 15:59:33 +08:00
feat: 修复tconfig中没有harmony
This commit is contained in:
@@ -31,6 +31,7 @@ type TConfig struct {
|
|||||||
WebSocketSetting *WebSocketConfig `json:"websocket,omitempty" yaml:"websocket,omitempty"`
|
WebSocketSetting *WebSocketConfig `json:"websocket,omitempty" yaml:"websocket,omitempty"`
|
||||||
IOS []*uixt.IOSDevice `json:"ios,omitempty" yaml:"ios,omitempty"`
|
IOS []*uixt.IOSDevice `json:"ios,omitempty" yaml:"ios,omitempty"`
|
||||||
Android []*uixt.AndroidDevice `json:"android,omitempty" yaml:"android,omitempty"`
|
Android []*uixt.AndroidDevice `json:"android,omitempty" yaml:"android,omitempty"`
|
||||||
|
Harmony []*uixt.HarmonyDevice `json:"harmony,omitempty" yaml:"harmony,omitempty"`
|
||||||
RequestTimeout float32 `json:"request_timeout,omitempty" yaml:"request_timeout,omitempty"` // request timeout in seconds
|
RequestTimeout float32 `json:"request_timeout,omitempty" yaml:"request_timeout,omitempty"` // request timeout in seconds
|
||||||
CaseTimeout float32 `json:"case_timeout,omitempty" yaml:"case_timeout,omitempty"` // testcase timeout in seconds
|
CaseTimeout float32 `json:"case_timeout,omitempty" yaml:"case_timeout,omitempty"` // testcase timeout in seconds
|
||||||
Export []string `json:"export,omitempty" yaml:"export,omitempty"`
|
Export []string `json:"export,omitempty" yaml:"export,omitempty"`
|
||||||
@@ -129,6 +130,27 @@ func (c *TConfig) SetIOS(options ...uixt.IOSDeviceOption) *TConfig {
|
|||||||
return c
|
return c
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func (c *TConfig) SetHarmony(options ...uixt.HarmonyDeviceOption) *TConfig {
|
||||||
|
harmonyOptions := &uixt.HarmonyDevice{}
|
||||||
|
for _, option := range options {
|
||||||
|
option(harmonyOptions)
|
||||||
|
}
|
||||||
|
|
||||||
|
// each device can have its own settings
|
||||||
|
if harmonyOptions.ConnectKey != "" {
|
||||||
|
c.Harmony = append(c.Harmony, harmonyOptions)
|
||||||
|
return c
|
||||||
|
}
|
||||||
|
|
||||||
|
// device UDID is not specified, settings will be shared
|
||||||
|
if len(c.Harmony) == 0 {
|
||||||
|
c.Harmony = append(c.Harmony, harmonyOptions)
|
||||||
|
} else {
|
||||||
|
c.Harmony[0] = harmonyOptions
|
||||||
|
}
|
||||||
|
return c
|
||||||
|
}
|
||||||
|
|
||||||
func (c *TConfig) SetAndroid(options ...uixt.AndroidDeviceOption) *TConfig {
|
func (c *TConfig) SetAndroid(options ...uixt.AndroidDeviceOption) *TConfig {
|
||||||
uiaOptions := &uixt.AndroidDevice{}
|
uiaOptions := &uixt.AndroidDevice{}
|
||||||
for _, option := range options {
|
for _, option := range options {
|
||||||
|
|||||||
@@ -762,6 +762,14 @@ func (s *StepRequest) IOS() *StepMobile {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Harmony creates a new harmony action
|
||||||
|
func (s *StepRequest) Harmony() *StepMobile {
|
||||||
|
s.step.Harmony = &MobileUI{}
|
||||||
|
return &StepMobile{
|
||||||
|
step: s.step,
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// Shell creates a new shell action
|
// Shell creates a new shell action
|
||||||
func (s *StepRequest) Shell(content string) *StepShell {
|
func (s *StepRequest) Shell(content string) *StepShell {
|
||||||
s.step.Shell = &Shell{
|
s.step.Shell = &Shell{
|
||||||
|
|||||||
Reference in New Issue
Block a user