mirror of
https://github.com/httprunner/httprunner.git
synced 2026-09-07 00:17:37 +08:00
feat: auto handle popups on each step finished
This commit is contained in:
@@ -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 {
|
||||
|
||||
Reference in New Issue
Block a user