mirror of
https://github.com/httprunner/httprunner.git
synced 2026-09-05 23:51:25 +08:00
optimize ClosePopupsHandler
This commit is contained in:
@@ -81,7 +81,7 @@ func TestTapUIWithScreenshot(t *testing.T) {
|
||||
t.Fatal(err)
|
||||
}
|
||||
|
||||
err = driver.TapByUIDetection([]string{"dyhouse", "shoppingbag"})
|
||||
err = driver.TapByUIDetection(WithScreenShotUITypes("dyhouse", "shoppingbag"))
|
||||
if err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
@@ -97,3 +97,30 @@ func TestDriverExtOCR(t *testing.T) {
|
||||
t.Logf("point.X: %v, point.Y: %v", point.X, point.Y)
|
||||
driverExt.Driver.TapFloat(point.X, point.Y-20)
|
||||
}
|
||||
|
||||
func TestClosePopup(t *testing.T) {
|
||||
setupAndroid(t)
|
||||
|
||||
screenResult, err := driverExt.GetScreenResult(
|
||||
WithScreenShotClose(true), WithScreenShotUpload(true))
|
||||
if err != nil {
|
||||
t.Logf("get screen result failed for popup handler: %v", err)
|
||||
return
|
||||
}
|
||||
|
||||
t.Logf("screen result: %v", screenResult)
|
||||
|
||||
// 1. there are no popups here (fast return normally)
|
||||
// 2. failed to close popup (maybe tap error, return error)
|
||||
// 3. successful to close popup (sleep and wait for next retry if existed)
|
||||
if screenResult.Popup == nil {
|
||||
t.Log("there are no popups here")
|
||||
return
|
||||
}
|
||||
|
||||
t.Logf("popup info: %v", screenResult.Popup)
|
||||
|
||||
if err = driverExt.tapPopupHandler(screenResult.Popup); err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user