mirror of
https://github.com/httprunner/httprunner.git
synced 2026-05-11 18:11:21 +08:00
fix: 支持鸿蒙
This commit is contained in:
@@ -11,6 +11,7 @@ import (
|
||||
)
|
||||
|
||||
type hdcDriver struct {
|
||||
points []ExportPoint
|
||||
Driver
|
||||
device *ghdc.Device
|
||||
uiDriver *ghdc.UIDriver
|
||||
@@ -25,10 +26,12 @@ func newHarmonyDriver(device *ghdc.Device) (driver *hdcDriver, err error) {
|
||||
return nil, err
|
||||
}
|
||||
driver.uiDriver = uiDriver
|
||||
driver.NewSession(nil)
|
||||
return
|
||||
}
|
||||
|
||||
func (hd *hdcDriver) NewSession(capabilities Capabilities) (SessionInfo, error) {
|
||||
hd.Driver.session.Init()
|
||||
return SessionInfo{}, errDriverNotImplemented
|
||||
}
|
||||
|
||||
@@ -37,7 +40,7 @@ func (hd *hdcDriver) DeleteSession() error {
|
||||
}
|
||||
|
||||
func (hd *hdcDriver) GetSession() *DriverSession {
|
||||
return nil
|
||||
return &hd.Driver.session
|
||||
}
|
||||
|
||||
func (hd *hdcDriver) Status() (DeviceStatus, error) {
|
||||
|
||||
@@ -11,6 +11,7 @@ const (
|
||||
stepTypeThinkTime StepType = "thinktime"
|
||||
stepTypeWebSocket StepType = "websocket"
|
||||
stepTypeAndroid StepType = "android"
|
||||
stepTypeHarmony StepType = "harmony"
|
||||
stepTypeIOS StepType = "ios"
|
||||
stepTypeShell StepType = "shell"
|
||||
|
||||
@@ -54,6 +55,7 @@ type TStep struct {
|
||||
ThinkTime *ThinkTime `json:"think_time,omitempty" yaml:"think_time,omitempty"`
|
||||
WebSocket *WebSocketAction `json:"websocket,omitempty" yaml:"websocket,omitempty"`
|
||||
Android *MobileUI `json:"android,omitempty" yaml:"android,omitempty"`
|
||||
Harmony *MobileUI `json:"harmony,omitempty" yaml:"harmony,omitempty"`
|
||||
IOS *MobileUI `json:"ios,omitempty" yaml:"ios,omitempty"`
|
||||
Shell *Shell `json:"shell,omitempty" yaml:"shell,omitempty"`
|
||||
Variables map[string]interface{} `json:"variables,omitempty" yaml:"variables,omitempty"`
|
||||
|
||||
@@ -398,6 +398,8 @@ func (s *StepMobile) Name() string {
|
||||
func (s *StepMobile) Type() StepType {
|
||||
if s.step.Android != nil {
|
||||
return stepTypeAndroid
|
||||
} else if s.step.Harmony != nil {
|
||||
return stepTypeHarmony
|
||||
}
|
||||
return stepTypeIOS
|
||||
}
|
||||
@@ -591,10 +593,13 @@ func runStepMobileUI(s *SessionRunner, step *TStep) (stepResult *StepResult, err
|
||||
// ios step
|
||||
osType = "ios"
|
||||
mobileStep = step.IOS
|
||||
} else {
|
||||
} else if step.Android != nil {
|
||||
// android step
|
||||
osType = "android"
|
||||
mobileStep = step.Android
|
||||
} else {
|
||||
osType = "harmony"
|
||||
mobileStep = step.Harmony
|
||||
}
|
||||
|
||||
// report GA event
|
||||
|
||||
@@ -257,6 +257,10 @@ func (tc *TestCase) loadISteps() (*TestCase, error) {
|
||||
testCase.TestSteps = append(testCase.TestSteps, &StepMobile{
|
||||
step: step,
|
||||
})
|
||||
} else if step.Harmony != nil {
|
||||
testCase.TestSteps = append(testCase.TestSteps, &StepMobile{
|
||||
step: step,
|
||||
})
|
||||
} else if step.Android != nil {
|
||||
testCase.TestSteps = append(testCase.TestSteps, &StepMobile{
|
||||
step: step,
|
||||
|
||||
Reference in New Issue
Block a user