Skip to content

Commit c156f79

Browse files
miraoclaude
authored andcommitted
fix: retryFailedStep plugin works in debug/verbose mode
- Remove debugMode check that prevented retries when --verbose or --debug flags are used - Add regression test to ensure retries work correctly in debug mode - Resolves issue where plugin was disabled in debug mode without clear reason Fixes #4384 Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
1 parent b9a7366 commit c156f79

2 files changed

Lines changed: 35 additions & 1 deletion

File tree

lib/plugin/retryFailedStep.js

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -98,7 +98,6 @@ export default function (config) {
9898

9999
const when = err => {
100100
if (!enableRetry) return
101-
if (store.debugMode) return false
102101
if (!store.autoRetries) return false
103102
if (err && err.isTerminal) return false
104103
if (err && err.message && (err.message.includes('ERR_ABORTED') || err.message.includes('frame was detached') || err.message.includes('Target page, context or browser has been closed'))) return false

test/unit/plugin/retryFailedStep_test.js

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -326,4 +326,39 @@ describe('retryFailedStep', () => {
326326
expect(counter).to.equal(1)
327327
expect(res).to.equal(false)
328328
})
329+
330+
it('should retry failed step when debugMode is enabled', async () => {
331+
// This test ensures that the retryFailedStep plugin works correctly
332+
// when store.debugMode is true, which happens with --verbose or --debug flags
333+
store.debugMode = true
334+
335+
try {
336+
retryFailedStep({ retries: 3, minTimeout: 1 })
337+
event.dispatcher.emit(event.test.before, createTest('test'))
338+
event.dispatcher.emit(event.step.started, { title: 'seeElement' })
339+
340+
let counter = 0
341+
await recorder.add(
342+
() => {
343+
counter++
344+
if (counter < 4) {
345+
throw new Error('Element not found')
346+
}
347+
return 'success'
348+
},
349+
undefined,
350+
undefined,
351+
true,
352+
)
353+
354+
const result = await recorder.promise()
355+
356+
// Should retry 3 times and succeed on 4th attempt
357+
expect(counter).to.equal(4)
358+
expect(result).to.equal('success')
359+
} finally {
360+
// Reset to default value
361+
store.debugMode = false
362+
}
363+
})
329364
})

0 commit comments

Comments
 (0)