fix: 支持鸿蒙

This commit is contained in:
余泓铮
2024-09-19 22:51:10 +08:00
parent ac6940b283
commit 4fb9baf5a8
4 changed files with 16 additions and 2 deletions

View File

@@ -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) {

View File

@@ -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"`

View File

@@ -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

View File

@@ -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,