mirror of
https://github.com/httprunner/httprunner.git
synced 2026-09-05 07:26:55 +08:00
feat: go back home on ios device
This commit is contained in:
@@ -23,6 +23,7 @@ const (
|
|||||||
cameraStop MobileMethod = "camera_stop"
|
cameraStop MobileMethod = "camera_stop"
|
||||||
recordStart MobileMethod = "record_start"
|
recordStart MobileMethod = "record_start"
|
||||||
recordStop MobileMethod = "record_stop"
|
recordStop MobileMethod = "record_stop"
|
||||||
|
uiHome MobileMethod = "home"
|
||||||
uiClick MobileMethod = "click"
|
uiClick MobileMethod = "click"
|
||||||
uiDoubleClick MobileMethod = "double_click"
|
uiDoubleClick MobileMethod = "double_click"
|
||||||
uiLongClick MobileMethod = "long_click"
|
uiLongClick MobileMethod = "long_click"
|
||||||
|
|||||||
@@ -33,6 +33,14 @@ func (s *StepIOS) InstallApp(path string) *StepIOS {
|
|||||||
return s
|
return s
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func (s *StepIOS) Home() *StepIOS {
|
||||||
|
s.step.IOS.Actions = append(s.step.IOS.Actions, MobileAction{
|
||||||
|
Method: uiHome,
|
||||||
|
Params: nil,
|
||||||
|
})
|
||||||
|
return &StepIOS{step: s.step}
|
||||||
|
}
|
||||||
|
|
||||||
func (s *StepIOS) Click(params interface{}) *StepIOS {
|
func (s *StepIOS) Click(params interface{}) *StepIOS {
|
||||||
s.step.IOS.Actions = append(s.step.IOS.Actions, MobileAction{
|
s.step.IOS.Actions = append(s.step.IOS.Actions, MobileAction{
|
||||||
Method: uiClick,
|
Method: uiClick,
|
||||||
@@ -345,6 +353,8 @@ func (w *wdaClient) doAction(action MobileAction) error {
|
|||||||
case appStart:
|
case appStart:
|
||||||
// TODO
|
// TODO
|
||||||
return errActionNotImplemented
|
return errActionNotImplemented
|
||||||
|
case uiHome:
|
||||||
|
return w.Driver.Homescreen()
|
||||||
case uiClick:
|
case uiClick:
|
||||||
// click on coordinate
|
// click on coordinate
|
||||||
if location, ok := action.Params.([]int); ok {
|
if location, ok := action.Params.([]int); ok {
|
||||||
|
|||||||
+2
-2
@@ -32,7 +32,7 @@ func TestIOSSettingsAction(t *testing.T) {
|
|||||||
Config: NewConfig("ios ui action on Settings"),
|
Config: NewConfig("ios ui action on Settings"),
|
||||||
TestSteps: []IStep{
|
TestSteps: []IStep{
|
||||||
NewStep("launch Settings").
|
NewStep("launch Settings").
|
||||||
IOS().Click("//*[@label='设置']").
|
IOS().Home().Click("//*[@label='设置']").
|
||||||
Validate().
|
Validate().
|
||||||
AssertNameExists("飞行模式", "「飞行模式」不存在").
|
AssertNameExists("飞行模式", "「飞行模式」不存在").
|
||||||
AssertNameNotExists("飞行模式2", "「飞行模式2」不存在"),
|
AssertNameNotExists("飞行模式2", "「飞行模式2」不存在"),
|
||||||
@@ -52,7 +52,7 @@ func TestIOSDouyinAction(t *testing.T) {
|
|||||||
Config: NewConfig("ios ui action on 抖音"),
|
Config: NewConfig("ios ui action on 抖音"),
|
||||||
TestSteps: []IStep{
|
TestSteps: []IStep{
|
||||||
NewStep("launch douyin").
|
NewStep("launch douyin").
|
||||||
IOS().Click("//*[@label='抖音']").
|
IOS().Home().Click("//*[@label='抖音']").
|
||||||
Validate().
|
Validate().
|
||||||
AssertNameExists("首页", "首页 tab 不存在").
|
AssertNameExists("首页", "首页 tab 不存在").
|
||||||
AssertNameExists("消息", "消息 tab 不存在"),
|
AssertNameExists("消息", "消息 tab 不存在"),
|
||||||
|
|||||||
Reference in New Issue
Block a user