mirror of
https://github.com/httprunner/httprunner.git
synced 2026-09-05 07:26:55 +08:00
feat: validate UI exists
This commit is contained in:
+28
-8
@@ -12,8 +12,8 @@ func TestAndroidAction(t *testing.T) {
|
||||
NewStep("launch douyin").
|
||||
Android().Serial("xxx").Click("抖音").
|
||||
Validate().
|
||||
AssertTextExists("首页", "首页 tab 不存在").
|
||||
AssertTextExists("消息", "消息 tab 不存在"),
|
||||
AssertXpathExists("首页", "首页 tab 不存在").
|
||||
AssertXpathExists("消息", "消息 tab 不存在"),
|
||||
NewStep("swipe up and down").
|
||||
Android().Serial("xxx").SwipeUp().SwipeUp().SwipeDown(),
|
||||
},
|
||||
@@ -27,15 +27,35 @@ func TestAndroidAction(t *testing.T) {
|
||||
}
|
||||
}
|
||||
|
||||
func TestIOSAction(t *testing.T) {
|
||||
func TestIOSSettingsAction(t *testing.T) {
|
||||
testCase := &TestCase{
|
||||
Config: NewConfig("ios ui action"),
|
||||
Config: NewConfig("ios ui action on Settings"),
|
||||
TestSteps: []IStep{
|
||||
NewStep("launch douyin").
|
||||
IOS().Click("//*[@label='抖音']").
|
||||
NewStep("launch Settings").
|
||||
IOS().Click("//*[@label='设置']").
|
||||
Validate().
|
||||
AssertTextExists("首页", "首页 tab 不存在").
|
||||
AssertTextExists("消息", "消息 tab 不存在"),
|
||||
AssertNameExists("飞行模式", "「飞行模式」不存在").
|
||||
AssertNameNotExists("飞行模式2", "「飞行模式2」不存在"),
|
||||
NewStep("swipe up and down").
|
||||
IOS().SwipeUp().SwipeUp().SwipeDown(),
|
||||
},
|
||||
}
|
||||
|
||||
err := NewRunner(t).Run(testCase)
|
||||
if err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
}
|
||||
|
||||
func TestIOSDouyinAction(t *testing.T) {
|
||||
testCase := &TestCase{
|
||||
Config: NewConfig("ios ui action on 抖音"),
|
||||
TestSteps: []IStep{
|
||||
NewStep("launch douyin").
|
||||
IOS().Click("//*[@label='抖音']").
|
||||
Validate().
|
||||
AssertNameExists("首页", "首页 tab 不存在").
|
||||
AssertNameExists("消息", "消息 tab 不存在"),
|
||||
NewStep("swipe up and down").
|
||||
IOS().SwipeUp().SwipeUp().SwipeDown(),
|
||||
},
|
||||
|
||||
Reference in New Issue
Block a user