mirror of
https://github.com/httprunner/httprunner.git
synced 2026-07-12 16:01:27 +08:00
change: update tests
This commit is contained in:
@@ -3,7 +3,6 @@
|
|||||||
package hrp
|
package hrp
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"fmt"
|
|
||||||
"testing"
|
"testing"
|
||||||
)
|
)
|
||||||
|
|
||||||
@@ -20,11 +19,8 @@ func TestAndroidAction(t *testing.T) {
|
|||||||
Android().Serial("xxx").SwipeUp().SwipeUp().SwipeDown(),
|
Android().Serial("xxx").SwipeUp().SwipeUp().SwipeDown(),
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
tCase := testCase.ToTCase()
|
err := NewRunner(t).Run(testCase)
|
||||||
fmt.Println(tCase)
|
if err != nil {
|
||||||
|
t.Fatal(err)
|
||||||
// err := NewRunner(t).Run(testCase)
|
}
|
||||||
// if err != nil {
|
|
||||||
// t.Fatal(err)
|
|
||||||
// }
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,8 +1,8 @@
|
|||||||
//go:build localtest
|
//go:build localtest
|
||||||
|
|
||||||
package hrp
|
package hrp
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"fmt"
|
|
||||||
"testing"
|
"testing"
|
||||||
)
|
)
|
||||||
|
|
||||||
@@ -20,8 +20,6 @@ func TestIOSSettingsAction(t *testing.T) {
|
|||||||
IOS().SwipeUp().SwipeUp().SwipeDown(),
|
IOS().SwipeUp().SwipeUp().SwipeDown(),
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
fmt.Println(testCase)
|
|
||||||
|
|
||||||
err := NewRunner(t).Run(testCase)
|
err := NewRunner(t).Run(testCase)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
t.Fatal(err)
|
t.Fatal(err)
|
||||||
@@ -40,18 +38,16 @@ func TestIOSSearchApp(t *testing.T) {
|
|||||||
IOS().Input("抖音\n"),
|
IOS().Input("抖音\n"),
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
fmt.Println(testCase)
|
err := NewRunner(t).Run(testCase)
|
||||||
|
if err != nil {
|
||||||
// err := NewRunner(t).Run(testCase)
|
t.Fatal(err)
|
||||||
// if err != nil {
|
}
|
||||||
// t.Fatal(err)
|
|
||||||
// }
|
|
||||||
}
|
}
|
||||||
|
|
||||||
func TestIOSAppLaunch(t *testing.T) {
|
func TestIOSAppLaunch(t *testing.T) {
|
||||||
testCase := &TestCase{
|
testCase := &TestCase{
|
||||||
Config: NewConfig("启动 & 关闭 App").
|
Config: NewConfig("启动 & 关闭 App").
|
||||||
SetIOS(WithPort(8100), WithMjpegPort(9100)),
|
SetIOS(WithWDAPort(8100), WithWDAMjpegPort(9100)),
|
||||||
TestSteps: []IStep{
|
TestSteps: []IStep{
|
||||||
NewStep("终止今日头条").
|
NewStep("终止今日头条").
|
||||||
IOS().AppTerminate("com.ss.iphone.article.News"),
|
IOS().AppTerminate("com.ss.iphone.article.News"),
|
||||||
@@ -63,18 +59,16 @@ func TestIOSAppLaunch(t *testing.T) {
|
|||||||
IOS().AppLaunchUnattached("com.ss.iphone.article.News"),
|
IOS().AppLaunchUnattached("com.ss.iphone.article.News"),
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
fmt.Println(testCase)
|
err := NewRunner(t).Run(testCase)
|
||||||
|
if err != nil {
|
||||||
// err := NewRunner(t).Run(testCase)
|
t.Fatal(err)
|
||||||
// if err != nil {
|
}
|
||||||
// t.Fatal(err)
|
|
||||||
// }
|
|
||||||
}
|
}
|
||||||
|
|
||||||
func TestIOSWeixinLive(t *testing.T) {
|
func TestIOSWeixinLive(t *testing.T) {
|
||||||
testCase := &TestCase{
|
testCase := &TestCase{
|
||||||
Config: NewConfig("ios ui action on 微信直播").
|
Config: NewConfig("ios ui action on 微信直播").
|
||||||
SetIOS(WithLogOn(true), WithPort(8100), WithMjpegPort(9100)),
|
SetIOS(WithLogOn(true), WithWDAPort(8100), WithWDAMjpegPort(9100)),
|
||||||
TestSteps: []IStep{
|
TestSteps: []IStep{
|
||||||
NewStep("启动微信").
|
NewStep("启动微信").
|
||||||
IOS().
|
IOS().
|
||||||
@@ -86,7 +80,7 @@ func TestIOSWeixinLive(t *testing.T) {
|
|||||||
NewStep("进入直播页").
|
NewStep("进入直播页").
|
||||||
IOS().
|
IOS().
|
||||||
Tap("发现").Sleep(5). // 进入「发现页」;等待 5 秒确保加载完成
|
Tap("发现").Sleep(5). // 进入「发现页」;等待 5 秒确保加载完成
|
||||||
TapByOCR("直播"). // 通过 OCR 识别「直播」
|
TapByOCR("直播"). // 通过 OCR 识别「直播」
|
||||||
Validate().
|
Validate().
|
||||||
AssertLabelExists("直播"),
|
AssertLabelExists("直播"),
|
||||||
NewStep("向上滑动 5 次").
|
NewStep("向上滑动 5 次").
|
||||||
@@ -95,8 +89,6 @@ func TestIOSWeixinLive(t *testing.T) {
|
|||||||
SwipeUp().Times(2).ScreenShot(), // 再上划 2 次,截图保存
|
SwipeUp().Times(2).ScreenShot(), // 再上划 2 次,截图保存
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
fmt.Println(testCase)
|
|
||||||
|
|
||||||
err := NewRunner(t).Run(testCase)
|
err := NewRunner(t).Run(testCase)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
t.Fatal(err)
|
t.Fatal(err)
|
||||||
@@ -117,12 +109,10 @@ func TestIOSCameraPhotoCapture(t *testing.T) {
|
|||||||
IOS().Tap("PhotoCapture"),
|
IOS().Tap("PhotoCapture"),
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
fmt.Println(testCase)
|
err := NewRunner(t).Run(testCase)
|
||||||
|
if err != nil {
|
||||||
// err := NewRunner(t).Run(testCase)
|
t.Fatal(err)
|
||||||
// if err != nil {
|
}
|
||||||
// t.Fatal(err)
|
|
||||||
// }
|
|
||||||
}
|
}
|
||||||
|
|
||||||
func TestIOSCameraVideoCapture(t *testing.T) {
|
func TestIOSCameraVideoCapture(t *testing.T) {
|
||||||
@@ -147,12 +137,10 @@ func TestIOSCameraVideoCapture(t *testing.T) {
|
|||||||
Tap("VideoCapture"), // 停止录像
|
Tap("VideoCapture"), // 停止录像
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
fmt.Println(testCase)
|
err := NewRunner(t).Run(testCase)
|
||||||
|
if err != nil {
|
||||||
// err := NewRunner(t).Run(testCase)
|
t.Fatal(err)
|
||||||
// if err != nil {
|
}
|
||||||
// t.Fatal(err)
|
|
||||||
// }
|
|
||||||
}
|
}
|
||||||
|
|
||||||
func TestIOSDouyinAction(t *testing.T) {
|
func TestIOSDouyinAction(t *testing.T) {
|
||||||
@@ -168,10 +156,8 @@ func TestIOSDouyinAction(t *testing.T) {
|
|||||||
IOS().SwipeUp().Times(3).SwipeDown(),
|
IOS().SwipeUp().Times(3).SwipeDown(),
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
fmt.Println(testCase)
|
err := NewRunner(t).Run(testCase)
|
||||||
|
if err != nil {
|
||||||
// err := NewRunner(t).Run(testCase)
|
t.Fatal(err)
|
||||||
// if err != nil {
|
}
|
||||||
// t.Fatal(err)
|
|
||||||
// }
|
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user