mirror of
https://github.com/httprunner/httprunner.git
synced 2026-05-11 18:11:21 +08:00
fix: check WDA summary logs
This commit is contained in:
@@ -27,6 +27,7 @@
|
||||
{
|
||||
"method": "swipe_to_tap_app",
|
||||
"params": "$app_name",
|
||||
"identifier": "启动抖音",
|
||||
"max_retry_times": 5
|
||||
},
|
||||
{
|
||||
@@ -45,20 +46,7 @@
|
||||
]
|
||||
},
|
||||
{
|
||||
"name": "在推荐页上划,直到出现「点击进入直播间」",
|
||||
"ios": {
|
||||
"actions": [
|
||||
{
|
||||
"method": "swipe_to_tap_text",
|
||||
"params": "点击进入直播间",
|
||||
"identifier": "进入直播间",
|
||||
"max_retry_times": 100
|
||||
}
|
||||
]
|
||||
}
|
||||
},
|
||||
{
|
||||
"name": "向上滑动,等待 10s",
|
||||
"name": "向上滑动 2 次",
|
||||
"ios": {
|
||||
"actions": [
|
||||
{
|
||||
@@ -87,6 +75,19 @@
|
||||
}
|
||||
]
|
||||
}
|
||||
},
|
||||
{
|
||||
"name": "在推荐页上划,直到出现「点击进入直播间」",
|
||||
"ios": {
|
||||
"actions": [
|
||||
{
|
||||
"method": "swipe_to_tap_text",
|
||||
"params": "点击进入直播间",
|
||||
"identifier": "进入直播间",
|
||||
"max_retry_times": 10
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
||||
|
||||
@@ -15,6 +15,7 @@ teststeps:
|
||||
params: com.ss.iphone.ugc.Aweme
|
||||
- method: swipe_to_tap_app
|
||||
params: $app_name
|
||||
identifier: 启动抖音
|
||||
max_retry_times: 5
|
||||
- method: sleep
|
||||
params: 5
|
||||
@@ -23,14 +24,7 @@ teststeps:
|
||||
assert: exists
|
||||
expect: 推荐
|
||||
msg: 抖音启动失败,「推荐」不存在
|
||||
- name: 在推荐页上划,直到出现「点击进入直播间」
|
||||
ios:
|
||||
actions:
|
||||
- method: swipe_to_tap_text
|
||||
params: 点击进入直播间
|
||||
identifier: 进入直播间
|
||||
max_retry_times: 100
|
||||
- name: 向上滑动,等待 10s
|
||||
- name: 向上滑动 2 次
|
||||
ios:
|
||||
actions:
|
||||
- method: swipe
|
||||
@@ -45,3 +39,10 @@ teststeps:
|
||||
- method: sleep
|
||||
params: 2
|
||||
- method: screenshot
|
||||
- name: 在推荐页上划,直到出现「点击进入直播间」
|
||||
ios:
|
||||
actions:
|
||||
- method: swipe_to_tap_text
|
||||
params: 点击进入直播间
|
||||
identifier: 进入直播间
|
||||
max_retry_times: 10
|
||||
|
||||
@@ -1,7 +1,6 @@
|
||||
package uitest
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"testing"
|
||||
|
||||
"github.com/httprunner/httprunner/v4/hrp"
|
||||
@@ -19,19 +18,19 @@ func TestIOSDouyinLive(t *testing.T) {
|
||||
IOS().
|
||||
Home().
|
||||
AppTerminate("com.ss.iphone.ugc.Aweme"). // 关闭已运行的抖音
|
||||
SwipeToTapApp("$app_name", hrp.WithMaxRetryTimes(5)).Sleep(5).
|
||||
SwipeToTapApp("$app_name", hrp.WithMaxRetryTimes(5), hrp.WithIdentifier("启动抖音")).Sleep(5).
|
||||
Validate().
|
||||
AssertOCRExists("推荐", "抖音启动失败,「推荐」不存在"),
|
||||
// hrp.NewStep("处理青少年弹窗").
|
||||
// IOS().
|
||||
// TapByOCR("我知道了", hrp.WithIgnoreNotFoundError(true)),
|
||||
hrp.NewStep("在推荐页上划,直到出现「点击进入直播间」").
|
||||
IOS().
|
||||
SwipeToTapText("点击进入直播间", hrp.WithMaxRetryTimes(100), hrp.WithIdentifier("进入直播间")),
|
||||
hrp.NewStep("向上滑动,等待 10s").
|
||||
hrp.NewStep("向上滑动 2 次").
|
||||
IOS().
|
||||
SwipeUp(hrp.WithIdentifier("第一次上划")).Sleep(2).ScreenShot(). // 上划 1 次,等待 2s,截图保存
|
||||
SwipeUp(hrp.WithIdentifier("第二次上划")).Sleep(2).ScreenShot(), // 再上划 1 次,等待 2s,截图保存
|
||||
hrp.NewStep("在推荐页上划,直到出现「点击进入直播间」").
|
||||
IOS().
|
||||
SwipeToTapText("点击进入直播间", hrp.WithMaxRetryTimes(10), hrp.WithIdentifier("进入直播间")),
|
||||
},
|
||||
}
|
||||
|
||||
@@ -42,14 +41,9 @@ func TestIOSDouyinLive(t *testing.T) {
|
||||
t.Fatal(err)
|
||||
}
|
||||
|
||||
runner := hrp.NewRunner(t)
|
||||
sessionRunner, err := runner.NewSessionRunner(testCase)
|
||||
runner := hrp.NewRunner(t).SetSaveTests(true)
|
||||
err := runner.Run(testCase)
|
||||
if err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
if err := sessionRunner.Start(nil); err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
summary := sessionRunner.GetSummary()
|
||||
fmt.Println(summary)
|
||||
}
|
||||
|
||||
@@ -1,7 +1,6 @@
|
||||
package uitest
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"testing"
|
||||
|
||||
"github.com/httprunner/httprunner/v4/hrp"
|
||||
@@ -43,14 +42,9 @@ func TestIOSWeixinLive(t *testing.T) {
|
||||
t.Fatal(err)
|
||||
}
|
||||
|
||||
runner := hrp.NewRunner(t)
|
||||
sessionRunner, err := runner.NewSessionRunner(testCase)
|
||||
runner := hrp.NewRunner(t).SetSaveTests(true)
|
||||
err := runner.Run(testCase)
|
||||
if err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
if err := sessionRunner.Start(nil); err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
summary := sessionRunner.GetSummary()
|
||||
fmt.Println(summary)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user