mirror of
https://github.com/httprunner/httprunner.git
synced 2026-08-29 03:57:22 +08:00
change: take screenshot after each step
This commit is contained in:
+10
-10
@@ -563,6 +563,16 @@ func runStepMobileUI(s *SessionRunner, step *TStep) (stepResult *StepResult, err
|
|||||||
attachments["error"] = err.Error()
|
attachments["error"] = err.Error()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// take screenshot after each step
|
||||||
|
screenshotPath, err := uiDriver.ScreenShot(
|
||||||
|
fmt.Sprintf("step_%d", time.Now().Unix()))
|
||||||
|
if err != nil {
|
||||||
|
log.Error().Err(err).Str("step", step.Name).Msg("take screenshot failed")
|
||||||
|
} else {
|
||||||
|
log.Info().Str("path", screenshotPath).Msg("take screenshot on step finished")
|
||||||
|
screenshots = append(screenshots, screenshotPath)
|
||||||
|
}
|
||||||
|
|
||||||
// save attachments
|
// save attachments
|
||||||
screenshots = append(screenshots, uiDriver.ScreenShots...)
|
screenshots = append(screenshots, uiDriver.ScreenShots...)
|
||||||
attachments["screenshots"] = screenshots
|
attachments["screenshots"] = screenshots
|
||||||
@@ -599,16 +609,6 @@ func runStepMobileUI(s *SessionRunner, step *TStep) (stepResult *StepResult, err
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// take snapshot
|
|
||||||
screenshotPath, err := uiDriver.ScreenShot(
|
|
||||||
fmt.Sprintf("validate_%d", time.Now().Unix()))
|
|
||||||
if err != nil {
|
|
||||||
log.Warn().Err(err).Str("step", step.Name).Msg("take screenshot failed")
|
|
||||||
} else {
|
|
||||||
log.Info().Str("path", screenshotPath).Msg("take screenshot before validation")
|
|
||||||
screenshots = append(screenshots, screenshotPath)
|
|
||||||
}
|
|
||||||
|
|
||||||
// validate
|
// validate
|
||||||
validateResults, err := validateUI(uiDriver, step.Validators)
|
validateResults, err := validateUI(uiDriver, step.Validators)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
|||||||
Reference in New Issue
Block a user