mirror of
https://github.com/httprunner/httprunner.git
synced 2026-07-10 23:12:41 +08:00
refactor: move action options
This commit is contained in:
126
step_ui.go
126
step_ui.go
@@ -67,9 +67,9 @@ func (s *StepMobile) Serial(serial string) *StepMobile {
|
||||
return s
|
||||
}
|
||||
|
||||
func (s *StepMobile) Log(actionName uixt.ActionMethod) *StepMobile {
|
||||
func (s *StepMobile) Log(actionName option.ActionMethod) *StepMobile {
|
||||
s.obj().Actions = append(s.obj().Actions, uixt.MobileAction{
|
||||
Method: uixt.ACTION_LOG,
|
||||
Method: option.ACTION_LOG,
|
||||
Params: actionName,
|
||||
})
|
||||
return s
|
||||
@@ -77,7 +77,7 @@ func (s *StepMobile) Log(actionName uixt.ActionMethod) *StepMobile {
|
||||
|
||||
func (s *StepMobile) InstallApp(path string) *StepMobile {
|
||||
s.obj().Actions = append(s.obj().Actions, uixt.MobileAction{
|
||||
Method: uixt.ACTION_AppInstall,
|
||||
Method: option.ACTION_AppInstall,
|
||||
Params: path,
|
||||
})
|
||||
return s
|
||||
@@ -85,7 +85,7 @@ func (s *StepMobile) InstallApp(path string) *StepMobile {
|
||||
|
||||
func (s *StepMobile) WebLoginNoneUI(packageName, phoneNumber string, captcha, password string) *StepMobile {
|
||||
s.obj().Actions = append(s.obj().Actions, uixt.MobileAction{
|
||||
Method: uixt.ACTION_WebLoginNoneUI,
|
||||
Method: option.ACTION_WebLoginNoneUI,
|
||||
Params: []string{packageName, phoneNumber, captcha, password},
|
||||
})
|
||||
return s
|
||||
@@ -93,7 +93,7 @@ func (s *StepMobile) WebLoginNoneUI(packageName, phoneNumber string, captcha, pa
|
||||
|
||||
func (s *StepMobile) AppLaunch(bundleId string) *StepMobile {
|
||||
s.obj().Actions = append(s.obj().Actions, uixt.MobileAction{
|
||||
Method: uixt.ACTION_AppLaunch,
|
||||
Method: option.ACTION_AppLaunch,
|
||||
Params: bundleId,
|
||||
})
|
||||
return s
|
||||
@@ -101,7 +101,7 @@ func (s *StepMobile) AppLaunch(bundleId string) *StepMobile {
|
||||
|
||||
func (s *StepMobile) AppTerminate(bundleId string) *StepMobile {
|
||||
s.obj().Actions = append(s.obj().Actions, uixt.MobileAction{
|
||||
Method: uixt.ACTION_AppTerminate,
|
||||
Method: option.ACTION_AppTerminate,
|
||||
Params: bundleId,
|
||||
})
|
||||
return s
|
||||
@@ -109,7 +109,7 @@ func (s *StepMobile) AppTerminate(bundleId string) *StepMobile {
|
||||
|
||||
func (s *StepMobile) Home() *StepMobile {
|
||||
s.obj().Actions = append(s.obj().Actions, uixt.MobileAction{
|
||||
Method: uixt.ACTION_Home,
|
||||
Method: option.ACTION_Home,
|
||||
Params: nil,
|
||||
})
|
||||
return s
|
||||
@@ -120,7 +120,7 @@ func (s *StepMobile) Home() *StepMobile {
|
||||
// else, X & Y will be considered as absolute coordinates
|
||||
func (s *StepMobile) TapXY(x, y float64, opts ...option.ActionOption) *StepMobile {
|
||||
action := uixt.MobileAction{
|
||||
Method: uixt.ACTION_TapXY,
|
||||
Method: option.ACTION_TapXY,
|
||||
Params: []float64{x, y},
|
||||
Options: option.NewActionOptions(opts...),
|
||||
}
|
||||
@@ -132,7 +132,7 @@ func (s *StepMobile) TapXY(x, y float64, opts ...option.ActionOption) *StepMobil
|
||||
// TapAbsXY taps the point {X,Y}, X & Y is absolute coordinates
|
||||
func (s *StepMobile) TapAbsXY(x, y float64, opts ...option.ActionOption) *StepMobile {
|
||||
action := uixt.MobileAction{
|
||||
Method: uixt.ACTION_TapAbsXY,
|
||||
Method: option.ACTION_TapAbsXY,
|
||||
Params: []float64{x, y},
|
||||
Options: option.NewActionOptions(opts...),
|
||||
}
|
||||
@@ -144,7 +144,7 @@ func (s *StepMobile) TapAbsXY(x, y float64, opts ...option.ActionOption) *StepMo
|
||||
// TapByOCR taps on the target element by OCR recognition
|
||||
func (s *StepMobile) TapByOCR(ocrText string, opts ...option.ActionOption) *StepMobile {
|
||||
action := uixt.MobileAction{
|
||||
Method: uixt.ACTION_TapByOCR,
|
||||
Method: option.ACTION_TapByOCR,
|
||||
Params: ocrText,
|
||||
Options: option.NewActionOptions(opts...),
|
||||
}
|
||||
@@ -156,7 +156,7 @@ func (s *StepMobile) TapByOCR(ocrText string, opts ...option.ActionOption) *Step
|
||||
// TapByCV taps on the target element by CV recognition
|
||||
func (s *StepMobile) TapByCV(imagePath string, opts ...option.ActionOption) *StepMobile {
|
||||
action := uixt.MobileAction{
|
||||
Method: uixt.ACTION_TapByCV,
|
||||
Method: option.ACTION_TapByCV,
|
||||
Params: imagePath,
|
||||
Options: option.NewActionOptions(opts...),
|
||||
}
|
||||
@@ -168,7 +168,7 @@ func (s *StepMobile) TapByCV(imagePath string, opts ...option.ActionOption) *Ste
|
||||
// TapByUITypes taps on the target element specified by uiTypes, the higher the uiTypes, the higher the priority
|
||||
func (s *StepMobile) TapByUITypes(opts ...option.ActionOption) *StepMobile {
|
||||
action := uixt.MobileAction{
|
||||
Method: uixt.ACTION_TapByCV,
|
||||
Method: option.ACTION_TapByCV,
|
||||
Options: option.NewActionOptions(opts...),
|
||||
}
|
||||
|
||||
@@ -179,7 +179,7 @@ func (s *StepMobile) TapByUITypes(opts ...option.ActionOption) *StepMobile {
|
||||
// AIAction do actions with VLM
|
||||
func (s *StepMobile) AIAction(prompt string, opts ...option.ActionOption) *StepMobile {
|
||||
action := uixt.MobileAction{
|
||||
Method: uixt.ACTION_AIAction,
|
||||
Method: option.ACTION_AIAction,
|
||||
Params: prompt,
|
||||
Options: option.NewActionOptions(opts...),
|
||||
}
|
||||
@@ -191,7 +191,7 @@ func (s *StepMobile) AIAction(prompt string, opts ...option.ActionOption) *StepM
|
||||
// DoubleTapXY double taps the point {X,Y}, X & Y is percentage of coordinates
|
||||
func (s *StepMobile) DoubleTapXY(x, y float64, opts ...option.ActionOption) *StepMobile {
|
||||
s.obj().Actions = append(s.obj().Actions, uixt.MobileAction{
|
||||
Method: uixt.ACTION_DoubleTapXY,
|
||||
Method: option.ACTION_DoubleTapXY,
|
||||
Params: []float64{x, y},
|
||||
Options: option.NewActionOptions(opts...),
|
||||
})
|
||||
@@ -200,7 +200,7 @@ func (s *StepMobile) DoubleTapXY(x, y float64, opts ...option.ActionOption) *Ste
|
||||
|
||||
func (s *StepMobile) Back() *StepMobile {
|
||||
action := uixt.MobileAction{
|
||||
Method: uixt.ACTION_Back,
|
||||
Method: option.ACTION_Back,
|
||||
Params: nil,
|
||||
Options: nil,
|
||||
}
|
||||
@@ -212,7 +212,7 @@ func (s *StepMobile) Back() *StepMobile {
|
||||
// Swipe drags from [sx, sy] to [ex, ey]
|
||||
func (s *StepMobile) Swipe(sx, sy, ex, ey float64, opts ...option.ActionOption) *StepMobile {
|
||||
action := uixt.MobileAction{
|
||||
Method: uixt.ACTION_Swipe,
|
||||
Method: option.ACTION_Swipe,
|
||||
Params: []float64{sx, sy, ex, ey},
|
||||
Options: option.NewActionOptions(opts...),
|
||||
}
|
||||
@@ -223,7 +223,7 @@ func (s *StepMobile) Swipe(sx, sy, ex, ey float64, opts ...option.ActionOption)
|
||||
|
||||
func (s *StepMobile) SwipeUp(opts ...option.ActionOption) *StepMobile {
|
||||
action := uixt.MobileAction{
|
||||
Method: uixt.ACTION_Swipe,
|
||||
Method: option.ACTION_Swipe,
|
||||
Params: "up",
|
||||
Options: option.NewActionOptions(opts...),
|
||||
}
|
||||
@@ -234,7 +234,7 @@ func (s *StepMobile) SwipeUp(opts ...option.ActionOption) *StepMobile {
|
||||
|
||||
func (s *StepMobile) SwipeDown(opts ...option.ActionOption) *StepMobile {
|
||||
action := uixt.MobileAction{
|
||||
Method: uixt.ACTION_Swipe,
|
||||
Method: option.ACTION_Swipe,
|
||||
Params: "down",
|
||||
Options: option.NewActionOptions(opts...),
|
||||
}
|
||||
@@ -245,7 +245,7 @@ func (s *StepMobile) SwipeDown(opts ...option.ActionOption) *StepMobile {
|
||||
|
||||
func (s *StepMobile) SwipeLeft(opts ...option.ActionOption) *StepMobile {
|
||||
action := uixt.MobileAction{
|
||||
Method: uixt.ACTION_Swipe,
|
||||
Method: option.ACTION_Swipe,
|
||||
Params: "left",
|
||||
Options: option.NewActionOptions(opts...),
|
||||
}
|
||||
@@ -256,7 +256,7 @@ func (s *StepMobile) SwipeLeft(opts ...option.ActionOption) *StepMobile {
|
||||
|
||||
func (s *StepMobile) SwipeRight(opts ...option.ActionOption) *StepMobile {
|
||||
action := uixt.MobileAction{
|
||||
Method: uixt.ACTION_Swipe,
|
||||
Method: option.ACTION_Swipe,
|
||||
Params: "right",
|
||||
Options: option.NewActionOptions(opts...),
|
||||
}
|
||||
@@ -267,7 +267,7 @@ func (s *StepMobile) SwipeRight(opts ...option.ActionOption) *StepMobile {
|
||||
|
||||
func (s *StepMobile) SwipeToTapApp(appName string, opts ...option.ActionOption) *StepMobile {
|
||||
action := uixt.MobileAction{
|
||||
Method: uixt.ACTION_SwipeToTapApp,
|
||||
Method: option.ACTION_SwipeToTapApp,
|
||||
Params: appName,
|
||||
Options: option.NewActionOptions(opts...),
|
||||
}
|
||||
@@ -278,7 +278,7 @@ func (s *StepMobile) SwipeToTapApp(appName string, opts ...option.ActionOption)
|
||||
|
||||
func (s *StepMobile) SwipeToTapText(text string, opts ...option.ActionOption) *StepMobile {
|
||||
action := uixt.MobileAction{
|
||||
Method: uixt.ACTION_SwipeToTapText,
|
||||
Method: option.ACTION_SwipeToTapText,
|
||||
Params: text,
|
||||
Options: option.NewActionOptions(opts...),
|
||||
}
|
||||
@@ -289,7 +289,7 @@ func (s *StepMobile) SwipeToTapText(text string, opts ...option.ActionOption) *S
|
||||
|
||||
func (s *StepMobile) SwipeToTapTexts(texts interface{}, opts ...option.ActionOption) *StepMobile {
|
||||
action := uixt.MobileAction{
|
||||
Method: uixt.ACTION_SwipeToTapTexts,
|
||||
Method: option.ACTION_SwipeToTapTexts,
|
||||
Params: texts,
|
||||
Options: option.NewActionOptions(opts...),
|
||||
}
|
||||
@@ -300,7 +300,7 @@ func (s *StepMobile) SwipeToTapTexts(texts interface{}, opts ...option.ActionOpt
|
||||
|
||||
func (s *StepMobile) SecondaryClick(x, y float64, options ...option.ActionOption) *StepMobile {
|
||||
action := uixt.MobileAction{
|
||||
Method: uixt.ACTION_SecondaryClick,
|
||||
Method: option.ACTION_SecondaryClick,
|
||||
Params: []float64{x, y},
|
||||
Options: option.NewActionOptions(options...),
|
||||
}
|
||||
@@ -310,7 +310,7 @@ func (s *StepMobile) SecondaryClick(x, y float64, options ...option.ActionOption
|
||||
|
||||
func (s *StepMobile) SecondaryClickBySelector(selector string, options ...option.ActionOption) *StepMobile {
|
||||
action := uixt.MobileAction{
|
||||
Method: uixt.ACTION_SecondaryClickBySelector,
|
||||
Method: option.ACTION_SecondaryClickBySelector,
|
||||
Params: selector,
|
||||
Options: option.NewActionOptions(options...),
|
||||
}
|
||||
@@ -320,7 +320,7 @@ func (s *StepMobile) SecondaryClickBySelector(selector string, options ...option
|
||||
|
||||
func (s *StepMobile) HoverBySelector(selector string, options ...option.ActionOption) *StepMobile {
|
||||
action := uixt.MobileAction{
|
||||
Method: uixt.ACTION_HoverBySelector,
|
||||
Method: option.ACTION_HoverBySelector,
|
||||
Params: selector,
|
||||
Options: option.NewActionOptions(options...),
|
||||
}
|
||||
@@ -330,7 +330,7 @@ func (s *StepMobile) HoverBySelector(selector string, options ...option.ActionOp
|
||||
|
||||
func (s *StepMobile) TapBySelector(selector string, options ...option.ActionOption) *StepMobile {
|
||||
action := uixt.MobileAction{
|
||||
Method: uixt.ACTION_TapBySelector,
|
||||
Method: option.ACTION_TapBySelector,
|
||||
Params: selector,
|
||||
Options: option.NewActionOptions(options...),
|
||||
}
|
||||
@@ -340,7 +340,7 @@ func (s *StepMobile) TapBySelector(selector string, options ...option.ActionOpti
|
||||
|
||||
func (s *StepMobile) WebCloseTab(idx int, options ...option.ActionOption) *StepMobile {
|
||||
action := uixt.MobileAction{
|
||||
Method: uixt.ACTION_WebCloseTab,
|
||||
Method: option.ACTION_WebCloseTab,
|
||||
Params: idx,
|
||||
Options: option.NewActionOptions(options...),
|
||||
}
|
||||
@@ -350,7 +350,7 @@ func (s *StepMobile) WebCloseTab(idx int, options ...option.ActionOption) *StepM
|
||||
|
||||
func (s *StepMobile) GetElementTextBySelector(selector string, options ...option.ActionOption) *StepMobile {
|
||||
action := uixt.MobileAction{
|
||||
Method: uixt.ACTION_GetElementTextBySelector,
|
||||
Method: option.ACTION_GetElementTextBySelector,
|
||||
Params: selector,
|
||||
Options: option.NewActionOptions(options...),
|
||||
}
|
||||
@@ -360,7 +360,7 @@ func (s *StepMobile) GetElementTextBySelector(selector string, options ...option
|
||||
|
||||
func (s *StepMobile) Input(text string, opts ...option.ActionOption) *StepMobile {
|
||||
action := uixt.MobileAction{
|
||||
Method: uixt.ACTION_Input,
|
||||
Method: option.ACTION_Input,
|
||||
Params: text,
|
||||
Options: option.NewActionOptions(opts...),
|
||||
}
|
||||
@@ -372,7 +372,7 @@ func (s *StepMobile) Input(text string, opts ...option.ActionOption) *StepMobile
|
||||
// Sleep specify sleep seconds after last action
|
||||
func (s *StepMobile) Sleep(nSeconds float64, startTime ...time.Time) *StepMobile {
|
||||
action := uixt.MobileAction{
|
||||
Method: uixt.ACTION_Sleep,
|
||||
Method: option.ACTION_Sleep,
|
||||
Params: nSeconds,
|
||||
Options: nil,
|
||||
}
|
||||
@@ -388,7 +388,7 @@ func (s *StepMobile) Sleep(nSeconds float64, startTime ...time.Time) *StepMobile
|
||||
|
||||
func (s *StepMobile) SleepMS(nMilliseconds int64, startTime ...time.Time) *StepMobile {
|
||||
action := uixt.MobileAction{
|
||||
Method: uixt.ACTION_SleepMS,
|
||||
Method: option.ACTION_SleepMS,
|
||||
Params: nMilliseconds,
|
||||
Options: nil,
|
||||
}
|
||||
@@ -408,7 +408,7 @@ func (s *StepMobile) SleepMS(nMilliseconds int64, startTime ...time.Time) *StepM
|
||||
// 2. [min1, max1, weight1, min2, max2, weight2, ...] : weight is the probability of the time range
|
||||
func (s *StepMobile) SleepRandom(params ...float64) *StepMobile {
|
||||
s.obj().Actions = append(s.obj().Actions, uixt.MobileAction{
|
||||
Method: uixt.ACTION_SleepRandom,
|
||||
Method: option.ACTION_SleepRandom,
|
||||
Params: params,
|
||||
Options: nil,
|
||||
})
|
||||
@@ -417,7 +417,7 @@ func (s *StepMobile) SleepRandom(params ...float64) *StepMobile {
|
||||
|
||||
func (s *StepMobile) EndToEndDelay(opts ...option.ActionOption) *StepMobile {
|
||||
s.obj().Actions = append(s.obj().Actions, uixt.MobileAction{
|
||||
Method: uixt.ACTION_EndToEndDelay,
|
||||
Method: option.ACTION_EndToEndDelay,
|
||||
Params: nil,
|
||||
Options: option.NewActionOptions(opts...),
|
||||
})
|
||||
@@ -426,7 +426,7 @@ func (s *StepMobile) EndToEndDelay(opts ...option.ActionOption) *StepMobile {
|
||||
|
||||
func (s *StepMobile) ScreenShot(opts ...option.ActionOption) *StepMobile {
|
||||
s.obj().Actions = append(s.obj().Actions, uixt.MobileAction{
|
||||
Method: uixt.ACTION_ScreenShot,
|
||||
Method: option.ACTION_ScreenShot,
|
||||
Params: nil,
|
||||
Options: option.NewActionOptions(opts...),
|
||||
})
|
||||
@@ -440,7 +440,7 @@ func (s *StepMobile) DisableAutoPopupHandler() *StepMobile {
|
||||
|
||||
func (s *StepMobile) ClosePopups(opts ...option.ActionOption) *StepMobile {
|
||||
s.obj().Actions = append(s.obj().Actions, uixt.MobileAction{
|
||||
Method: uixt.ACTION_ClosePopups,
|
||||
Method: option.ACTION_ClosePopups,
|
||||
Params: nil,
|
||||
Options: option.NewActionOptions(opts...),
|
||||
})
|
||||
@@ -449,7 +449,7 @@ func (s *StepMobile) ClosePopups(opts ...option.ActionOption) *StepMobile {
|
||||
|
||||
func (s *StepMobile) Call(name string, fn func(), opts ...option.ActionOption) *StepMobile {
|
||||
s.obj().Actions = append(s.obj().Actions, uixt.MobileAction{
|
||||
Method: uixt.ACTION_CallFunction,
|
||||
Method: option.ACTION_CallFunction,
|
||||
Params: name, // function description
|
||||
Fn: fn,
|
||||
Options: option.NewActionOptions(opts...),
|
||||
@@ -493,8 +493,8 @@ type StepMobileUIValidation struct {
|
||||
|
||||
func (s *StepMobileUIValidation) AssertNameExists(expectedName string, msg ...string) *StepMobileUIValidation {
|
||||
v := Validator{
|
||||
Check: uixt.SelectorName,
|
||||
Assert: uixt.AssertionExists,
|
||||
Check: option.SelectorName,
|
||||
Assert: option.AssertionExists,
|
||||
Expect: expectedName,
|
||||
}
|
||||
if len(msg) > 0 {
|
||||
@@ -508,8 +508,8 @@ func (s *StepMobileUIValidation) AssertNameExists(expectedName string, msg ...st
|
||||
|
||||
func (s *StepMobileUIValidation) AssertNameNotExists(expectedName string, msg ...string) *StepMobileUIValidation {
|
||||
v := Validator{
|
||||
Check: uixt.SelectorName,
|
||||
Assert: uixt.AssertionNotExists,
|
||||
Check: option.SelectorName,
|
||||
Assert: option.AssertionNotExists,
|
||||
Expect: expectedName,
|
||||
}
|
||||
if len(msg) > 0 {
|
||||
@@ -523,8 +523,8 @@ func (s *StepMobileUIValidation) AssertNameNotExists(expectedName string, msg ..
|
||||
|
||||
func (s *StepMobileUIValidation) AssertLabelExists(expectedLabel string, msg ...string) *StepMobileUIValidation {
|
||||
v := Validator{
|
||||
Check: uixt.SelectorLabel,
|
||||
Assert: uixt.AssertionExists,
|
||||
Check: option.SelectorLabel,
|
||||
Assert: option.AssertionExists,
|
||||
Expect: expectedLabel,
|
||||
}
|
||||
if len(msg) > 0 {
|
||||
@@ -538,8 +538,8 @@ func (s *StepMobileUIValidation) AssertLabelExists(expectedLabel string, msg ...
|
||||
|
||||
func (s *StepMobileUIValidation) AssertLabelNotExists(expectedLabel string, msg ...string) *StepMobileUIValidation {
|
||||
v := Validator{
|
||||
Check: uixt.SelectorLabel,
|
||||
Assert: uixt.AssertionNotExists,
|
||||
Check: option.SelectorLabel,
|
||||
Assert: option.AssertionNotExists,
|
||||
Expect: expectedLabel,
|
||||
}
|
||||
if len(msg) > 0 {
|
||||
@@ -553,8 +553,8 @@ func (s *StepMobileUIValidation) AssertLabelNotExists(expectedLabel string, msg
|
||||
|
||||
func (s *StepMobileUIValidation) AssertOCRExists(expectedText string, msg ...string) *StepMobileUIValidation {
|
||||
v := Validator{
|
||||
Check: uixt.SelectorOCR,
|
||||
Assert: uixt.AssertionExists,
|
||||
Check: option.SelectorOCR,
|
||||
Assert: option.AssertionExists,
|
||||
Expect: expectedText,
|
||||
}
|
||||
if len(msg) > 0 {
|
||||
@@ -568,8 +568,8 @@ func (s *StepMobileUIValidation) AssertOCRExists(expectedText string, msg ...str
|
||||
|
||||
func (s *StepMobileUIValidation) AssertOCRNotExists(expectedText string, msg ...string) *StepMobileUIValidation {
|
||||
v := Validator{
|
||||
Check: uixt.SelectorOCR,
|
||||
Assert: uixt.AssertionNotExists,
|
||||
Check: option.SelectorOCR,
|
||||
Assert: option.AssertionNotExists,
|
||||
Expect: expectedText,
|
||||
}
|
||||
if len(msg) > 0 {
|
||||
@@ -583,8 +583,8 @@ func (s *StepMobileUIValidation) AssertOCRNotExists(expectedText string, msg ...
|
||||
|
||||
func (s *StepMobileUIValidation) AssertImageExists(expectedImagePath string, msg ...string) *StepMobileUIValidation {
|
||||
v := Validator{
|
||||
Check: uixt.SelectorImage,
|
||||
Assert: uixt.AssertionExists,
|
||||
Check: option.SelectorImage,
|
||||
Assert: option.AssertionExists,
|
||||
Expect: expectedImagePath,
|
||||
}
|
||||
if len(msg) > 0 {
|
||||
@@ -598,8 +598,8 @@ func (s *StepMobileUIValidation) AssertImageExists(expectedImagePath string, msg
|
||||
|
||||
func (s *StepMobileUIValidation) AssertImageNotExists(expectedImagePath string, msg ...string) *StepMobileUIValidation {
|
||||
v := Validator{
|
||||
Check: uixt.SelectorImage,
|
||||
Assert: uixt.AssertionNotExists,
|
||||
Check: option.SelectorImage,
|
||||
Assert: option.AssertionNotExists,
|
||||
Expect: expectedImagePath,
|
||||
}
|
||||
if len(msg) > 0 {
|
||||
@@ -613,8 +613,8 @@ func (s *StepMobileUIValidation) AssertImageNotExists(expectedImagePath string,
|
||||
|
||||
func (s *StepMobileUIValidation) AssertAI(prompt string, msg ...string) *StepMobileUIValidation {
|
||||
v := Validator{
|
||||
Check: uixt.SelectorAI,
|
||||
Assert: uixt.AssertionAI,
|
||||
Check: option.SelectorAI,
|
||||
Assert: option.AssertionAI,
|
||||
Expect: prompt,
|
||||
}
|
||||
if len(msg) > 0 {
|
||||
@@ -628,8 +628,8 @@ func (s *StepMobileUIValidation) AssertAI(prompt string, msg ...string) *StepMob
|
||||
|
||||
func (s *StepMobileUIValidation) AssertAppInForeground(packageName string, msg ...string) *StepMobileUIValidation {
|
||||
v := Validator{
|
||||
Check: uixt.SelectorForegroundApp,
|
||||
Assert: uixt.AssertionEqual,
|
||||
Check: option.SelectorForegroundApp,
|
||||
Assert: option.AssertionEqual,
|
||||
Expect: packageName,
|
||||
}
|
||||
if len(msg) > 0 {
|
||||
@@ -643,8 +643,8 @@ func (s *StepMobileUIValidation) AssertAppInForeground(packageName string, msg .
|
||||
|
||||
func (s *StepMobileUIValidation) AssertAppNotInForeground(packageName string, msg ...string) *StepMobileUIValidation {
|
||||
v := Validator{
|
||||
Check: uixt.SelectorForegroundApp,
|
||||
Assert: uixt.AssertionNotEqual,
|
||||
Check: option.SelectorForegroundApp,
|
||||
Assert: option.AssertionNotEqual,
|
||||
Expect: packageName,
|
||||
}
|
||||
if len(msg) > 0 {
|
||||
@@ -739,7 +739,7 @@ func runStepMobileUI(s *SessionRunner, step IStep) (stepResult *StepResult, err
|
||||
startTime := time.Now()
|
||||
actionResult := &ActionResult{
|
||||
MobileAction: uixt.MobileAction{
|
||||
Method: uixt.ACTION_GetForegroundApp,
|
||||
Method: option.ACTION_GetForegroundApp,
|
||||
Params: "[ForDebug] check foreground app",
|
||||
},
|
||||
StartTime: startTime.Unix(),
|
||||
@@ -758,7 +758,7 @@ func runStepMobileUI(s *SessionRunner, step IStep) (stepResult *StepResult, err
|
||||
startTime := time.Now()
|
||||
actionResult := &ActionResult{
|
||||
MobileAction: uixt.MobileAction{
|
||||
Method: uixt.ACTION_ClosePopups,
|
||||
Method: option.ACTION_ClosePopups,
|
||||
Params: "[ForDebug] close popups handler",
|
||||
},
|
||||
StartTime: startTime.Unix(),
|
||||
@@ -802,9 +802,9 @@ func runStepMobileUI(s *SessionRunner, step IStep) (stepResult *StepResult, err
|
||||
}
|
||||
|
||||
// stat uixt action
|
||||
if action.Method == uixt.ACTION_LOG {
|
||||
if action.Method == option.ACTION_LOG {
|
||||
log.Info().Interface("action", action.Params).Msg("stat uixt action")
|
||||
actionMethod := uixt.ActionMethod(action.Params.(string))
|
||||
actionMethod := option.ActionMethod(action.Params.(string))
|
||||
s.summary.Stat.Actions[actionMethod]++
|
||||
continue
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user