change: update tests

This commit is contained in:
debugtalk
2022-09-30 17:44:01 +08:00
parent 8698a152ac
commit b732313b1e
2 changed files with 28 additions and 46 deletions
+4 -8
View File
@@ -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)
// }
} }
+23 -37
View File
@@ -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().
@@ -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)
// }
} }