From 4fb9baf5a84e50ba7213904baaa035333dc0bbee Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E4=BD=99=E6=B3=93=E9=93=AE?= Date: Thu, 19 Sep 2024 22:51:10 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20=E6=94=AF=E6=8C=81=E9=B8=BF=E8=92=99?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- hrp/pkg/uixt/harmony_hdc_driver.go | 5 ++++- hrp/step.go | 2 ++ hrp/step_mobile_ui.go | 7 ++++++- hrp/testcase.go | 4 ++++ 4 files changed, 16 insertions(+), 2 deletions(-) diff --git a/hrp/pkg/uixt/harmony_hdc_driver.go b/hrp/pkg/uixt/harmony_hdc_driver.go index bffd400b..456f7173 100644 --- a/hrp/pkg/uixt/harmony_hdc_driver.go +++ b/hrp/pkg/uixt/harmony_hdc_driver.go @@ -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) { diff --git a/hrp/step.go b/hrp/step.go index 328f8343..f0c69f35 100644 --- a/hrp/step.go +++ b/hrp/step.go @@ -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"` diff --git a/hrp/step_mobile_ui.go b/hrp/step_mobile_ui.go index 2b611c7b..1930b71c 100644 --- a/hrp/step_mobile_ui.go +++ b/hrp/step_mobile_ui.go @@ -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 diff --git a/hrp/testcase.go b/hrp/testcase.go index 42dae8fc..03a16fc0 100644 --- a/hrp/testcase.go +++ b/hrp/testcase.go @@ -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,