update: android douyin demo

This commit is contained in:
xucong053
2022-09-28 14:36:00 +08:00
parent dd9cf7dc6e
commit 32027c3ef5
3 changed files with 12 additions and 5 deletions

View File

@@ -11,9 +11,16 @@ func TestIOSDouYinLive(t *testing.T) {
Config: hrp.NewConfig("通过 feed 头像进入抖音直播间").
SetAndroid(hrp.WithAdbLogOn(true), hrp.WithMjpegPortA(9100)),
TestSteps: []hrp.IStep{
hrp.NewStep("打开网页").
Android().
Home().
AppTerminate("com.google.android.apps.chrome.Main").Sleep(1). // 关闭已运行的抖音,确保启动抖音后在「抖音」首页
SwipeToTapApp("Chrome", hrp.WithMaxRetryTimes(5)).TapByOCR("Search").Input("https://gtftask.bytedance.com/local-time").TapByOCR("前往").Sleep(5).
Validate().
AssertOCRExists("1664", "网页打开失败"),
hrp.NewStep("启动抖音").
Android().
Home().StartCamera().Sleep(10).StopCamera().
Home().
AppTerminate("com.ss.android.ugc.aweme"). // 关闭已运行的抖音,确保启动抖音后在「抖音」首页
SwipeToTapApp("抖音", hrp.WithMaxRetryTimes(5)).
Sleep(10),
@@ -33,10 +40,10 @@ func TestIOSDouYinLive(t *testing.T) {
},
}
if err := testCase.Dump2JSON("android_demo_douyin_live.json"); err != nil {
if err := testCase.Dump2JSON("demo_android_douyin_live.json"); err != nil {
t.Fatal(err)
}
if err := testCase.Dump2YAML("android_demo_douyin_live.yaml"); err != nil {
if err := testCase.Dump2YAML("demo_android_douyin_live.yaml"); err != nil {
t.Fatal(err)
}

View File

@@ -304,7 +304,7 @@ func (dExt *DriverExt) IsImageExist(text string) bool {
var errActionNotImplemented = errors.New("UI action not implemented")
func (dExt *DriverExt) DoAction(action MobileAction) error {
log.Info().Str("method", string(action.Method)).Interface("params", action.Params).Msg("start iOS UI action")
log.Info().Str("method", string(action.Method)).Interface("params", action.Params).Msg("start UI action")
switch action.Method {
case AppInstall:

View File

@@ -240,7 +240,7 @@ func (dExt *DriverExt) StartLogRecording(identifier string) error {
}
func (dExt *DriverExt) GetLogs() (interface{}, error) {
log.Info().Msg("stop WDA log recording")
log.Info().Msg("stop log recording")
if _, ok := dExt.Driver.(*wdaDriver); ok {
data := map[string]interface{}{"action": "stop"}
reply, err := dExt.triggerWDALog(data)