mirror of
https://github.com/httprunner/httprunner.git
synced 2026-05-28 11:59:41 +08:00
compatible with old tap_cv params
This commit is contained in:
@@ -11,6 +11,7 @@ import (
|
||||
|
||||
"github.com/httprunner/httprunner/v4/hrp/internal/builtin"
|
||||
"github.com/httprunner/httprunner/v4/hrp/internal/code"
|
||||
"github.com/httprunner/httprunner/v4/hrp/pkg/uixt"
|
||||
)
|
||||
|
||||
// ITestCase represents interface for testcases,
|
||||
@@ -112,6 +113,13 @@ func (tc *TCase) MakeCompat() (err error) {
|
||||
|
||||
// 3. deal with extract expr including hyphen
|
||||
convertExtract(step.Extract)
|
||||
|
||||
// 4. deal with mobile step compatibility
|
||||
if step.Android != nil {
|
||||
convertCompatMobileStep(step.Android)
|
||||
} else if step.IOS != nil {
|
||||
convertCompatMobileStep(step.IOS)
|
||||
}
|
||||
}
|
||||
return nil
|
||||
}
|
||||
@@ -352,6 +360,26 @@ func convertExtract(extract map[string]string) {
|
||||
}
|
||||
}
|
||||
|
||||
func convertCompatMobileStep(mobileStep *MobileStep) {
|
||||
if mobileStep == nil {
|
||||
return
|
||||
}
|
||||
if mobileStep.MobileAction.Method == uixt.ACTION_TapByCV {
|
||||
uiTypes, _ := builtin.ConvertToStringSlice(mobileStep.MobileAction.Params)
|
||||
options := mobileStep.MobileAction.ActionOptions
|
||||
options.ScreenShotWithUITypes = append(options.ScreenShotWithUITypes, uiTypes...)
|
||||
}
|
||||
for i := 0; i < len(mobileStep.Actions); i++ {
|
||||
ma := mobileStep.Actions[i]
|
||||
if ma.Method != uixt.ACTION_TapByCV {
|
||||
continue
|
||||
}
|
||||
uiTypes, _ := builtin.ConvertToStringSlice(ma.Params)
|
||||
ma.ActionOptions.ScreenShotWithUITypes = append(ma.ActionOptions.ScreenShotWithUITypes, uiTypes...)
|
||||
mobileStep.Actions[i] = ma
|
||||
}
|
||||
}
|
||||
|
||||
// convertJmespathExpr deals with limited jmespath expression conversion
|
||||
func convertJmespathExpr(checkExpr string) string {
|
||||
if strings.Contains(checkExpr, textExtractorSubRegexp) {
|
||||
|
||||
Reference in New Issue
Block a user