mirror of
https://github.com/httprunner/httprunner.git
synced 2026-09-07 16:40:50 +08:00
feat: log uixt action
This commit is contained in:
@@ -1 +1 @@
|
|||||||
v5.0.0+2411102239
|
v5.0.0+2411111113
|
||||||
|
|||||||
@@ -15,6 +15,7 @@ import (
|
|||||||
type ActionMethod string
|
type ActionMethod string
|
||||||
|
|
||||||
const (
|
const (
|
||||||
|
ACTION_LOG ActionMethod = "log"
|
||||||
ACTION_AppInstall ActionMethod = "install"
|
ACTION_AppInstall ActionMethod = "install"
|
||||||
ACTION_AppUninstall ActionMethod = "uninstall"
|
ACTION_AppUninstall ActionMethod = "uninstall"
|
||||||
ACTION_AppClear ActionMethod = "app_clear"
|
ACTION_AppClear ActionMethod = "app_clear"
|
||||||
@@ -565,6 +566,9 @@ func (dExt *DriverExt) DoAction(action MobileAction) (err error) {
|
|||||||
}()
|
}()
|
||||||
|
|
||||||
switch action.Method {
|
switch action.Method {
|
||||||
|
case ACTION_LOG:
|
||||||
|
// TODO: stat action
|
||||||
|
log.Info().Str("action", action.Params.(string)).Msg("log uixt action")
|
||||||
case ACTION_AppInstall:
|
case ACTION_AppInstall:
|
||||||
if appUrl, ok := action.Params.(string); ok {
|
if appUrl, ok := action.Params.(string); ok {
|
||||||
if err = dExt.InstallByUrl(appUrl, WithRetryTimes(action.MaxRetryTimes)); err != nil {
|
if err = dExt.InstallByUrl(appUrl, WithRetryTimes(action.MaxRetryTimes)); err != nil {
|
||||||
|
|||||||
@@ -650,6 +650,10 @@ func (r *SessionRunner) RunStep(step IStep) (stepResult *StepResult, err error)
|
|||||||
return stepResult, nil
|
return stepResult, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func (r *SessionRunner) GetSummary() *TestCaseSummary {
|
||||||
|
return r.summary
|
||||||
|
}
|
||||||
|
|
||||||
func (r *SessionRunner) parseStepStruct(step IStep) error {
|
func (r *SessionRunner) parseStepStruct(step IStep) error {
|
||||||
caseConfig := r.caseRunner.TestCase.Config.Get()
|
caseConfig := r.caseRunner.TestCase.Config.Get()
|
||||||
stepConfig := step.Config()
|
stepConfig := step.Config()
|
||||||
|
|||||||
@@ -131,6 +131,14 @@ func (s *StepMobile) Serial(serial string) *StepMobile {
|
|||||||
return s
|
return s
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func (s *StepMobile) Log(actionName string) *StepMobile {
|
||||||
|
s.obj().Actions = append(s.obj().Actions, uixt.MobileAction{
|
||||||
|
Method: uixt.ACTION_LOG,
|
||||||
|
Params: actionName,
|
||||||
|
})
|
||||||
|
return s
|
||||||
|
}
|
||||||
|
|
||||||
func (s *StepMobile) InstallApp(path string) *StepMobile {
|
func (s *StepMobile) InstallApp(path string) *StepMobile {
|
||||||
s.obj().Actions = append(s.obj().Actions, uixt.MobileAction{
|
s.obj().Actions = append(s.obj().Actions, uixt.MobileAction{
|
||||||
Method: uixt.ACTION_AppInstall,
|
Method: uixt.ACTION_AppInstall,
|
||||||
@@ -676,6 +684,11 @@ func runStepMobileUI(s *SessionRunner, step IStep) (stepResult *StepResult, err
|
|||||||
return nil, errors.New("invalid mobile UI step type")
|
return nil, errors.New("invalid mobile UI step type")
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// TODO: fix this
|
||||||
|
if mobileStep.OSType == "" {
|
||||||
|
mobileStep.OSType = string(stepTypeAndroid)
|
||||||
|
}
|
||||||
|
|
||||||
// report GA event
|
// report GA event
|
||||||
go sdk.SendGA4Event("hrp_run_ui", map[string]interface{}{
|
go sdk.SendGA4Event("hrp_run_ui", map[string]interface{}{
|
||||||
"osType": mobileStep.OSType,
|
"osType": mobileStep.OSType,
|
||||||
|
|||||||
@@ -749,6 +749,14 @@ func (s *StepRequest) WebSocket() *StepWebSocket {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// MobileUI creates a new mobile step session
|
||||||
|
func (s *StepRequest) MobileUI() *StepMobile {
|
||||||
|
return &StepMobile{
|
||||||
|
StepConfig: s.StepConfig,
|
||||||
|
Mobile: &MobileUI{},
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// Android creates a new android step session
|
// Android creates a new android step session
|
||||||
func (s *StepRequest) Android(options ...uixt.AndroidDeviceOption) *StepMobile {
|
func (s *StepRequest) Android(options ...uixt.AndroidDeviceOption) *StepMobile {
|
||||||
androidOptions := &uixt.AndroidDevice{}
|
androidOptions := &uixt.AndroidDevice{}
|
||||||
|
|||||||
Reference in New Issue
Block a user