mirror of
https://github.com/httprunner/httprunner.git
synced 2026-09-05 07:26:55 +08:00
fix: cancel UI action when case timeout
This commit is contained in:
+6
-3
@@ -851,10 +851,10 @@ func runStepMobileUI(s *SessionRunner, step IStep) (stepResult *StepResult, err
|
|||||||
for _, action := range mobileStep.Actions {
|
for _, action := range mobileStep.Actions {
|
||||||
select {
|
select {
|
||||||
case <-s.caseRunner.hrpRunner.caseTimeoutTimer.C:
|
case <-s.caseRunner.hrpRunner.caseTimeoutTimer.C:
|
||||||
log.Warn().Msg("timeout in mobile UI runner")
|
log.Warn().Msg("case timeout in mobile UI runner, abort running")
|
||||||
return stepResult, errors.Wrap(code.TimeoutError, "mobile UI runner timeout")
|
return stepResult, errors.Wrap(code.TimeoutError, "mobile UI runner case timeout")
|
||||||
case <-s.caseRunner.hrpRunner.interruptSignal:
|
case <-s.caseRunner.hrpRunner.interruptSignal:
|
||||||
log.Warn().Msg("interrupted in mobile UI runner")
|
log.Warn().Msg("interrupted in mobile UI runner, abort running")
|
||||||
return stepResult, errors.Wrap(code.InterruptError, "mobile UI runner interrupted")
|
return stepResult, errors.Wrap(code.InterruptError, "mobile UI runner interrupted")
|
||||||
default:
|
default:
|
||||||
actionStartTime := time.Now()
|
actionStartTime := time.Now()
|
||||||
@@ -934,6 +934,9 @@ func runStepMobileUI(s *SessionRunner, step IStep) (stepResult *StepResult, err
|
|||||||
case <-s.caseRunner.hrpRunner.interruptSignal:
|
case <-s.caseRunner.hrpRunner.interruptSignal:
|
||||||
log.Warn().Msg("cancelling action due to interrupt signal")
|
log.Warn().Msg("cancelling action due to interrupt signal")
|
||||||
cancel()
|
cancel()
|
||||||
|
case <-s.caseRunner.hrpRunner.caseTimeoutTimer.C:
|
||||||
|
log.Warn().Msg("cancelling action due to case timeout")
|
||||||
|
cancel()
|
||||||
case <-ctx.Done():
|
case <-ctx.Done():
|
||||||
// Context already cancelled
|
// Context already cancelled
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user