feat: auto handle popups on each step finished

This commit is contained in:
lilong.129
2023-06-22 12:49:25 +08:00
parent e1cf7d9679
commit a98c497995
7 changed files with 43 additions and 44 deletions
+8 -4
View File
@@ -6,7 +6,6 @@ import (
"github.com/pkg/errors"
"github.com/rs/zerolog/log"
"github.com/httprunner/httprunner/v4/hrp/internal/builtin"
"github.com/httprunner/httprunner/v4/hrp/internal/code"
"github.com/httprunner/httprunner/v4/hrp/pkg/uixt"
)
@@ -598,12 +597,17 @@ func runStepMobileUI(s *SessionRunner, step *TStep) (stepResult *StepResult, err
}
}
// take screenshot after each step
if _, _, err2 := uiDriver.TakeScreenShot(
builtin.GenNameWithTimestamp("%d_step_") + step.Name); err2 != nil {
// take screenshot and get screen texts by OCR
screenResult, err2 := uiDriver.GetScreenResult()
if err2 != nil {
log.Error().Err(err2).Str("step", step.Name).Msg("take screenshot failed on step finished")
}
// automatic handling of pop-up windows on each step finished
if err3 := uiDriver.AutoPopupHandler(screenResult.Texts); err3 != nil {
log.Error().Err(err3).Msg("auto handle popup failed")
}
// save attachments
cacheData := uiDriver.GetStepCacheData()
for key, value := range cacheData {