Skip to content

Commit f5cc169

Browse files
committed
fix: retryFailedStep plugin works in debug/verbose mode
- Remove debugMode check that prevented retries when --verbose or --debug flags are used - Fix affects both retryFailedStep and enhancedRetryFailedStep plugins - 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
1 parent a396c5b commit f5cc169

File tree

3 files changed

+35
-2
lines changed

3 files changed

+35
-2
lines changed

lib/plugin/enhancedRetryFailedStep.js

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,6 @@ module.exports = config => {
2626

2727
const when = err => {
2828
if (!enableRetry) return false
29-
if (store.debugMode) return false
3029
if (!store.autoRetries) return false
3130
if (customWhen) return customWhen(err)
3231
return true

lib/plugin/retryFailedStep.js

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -83,7 +83,6 @@ module.exports = config => {
8383

8484
const when = err => {
8585
if (!enableRetry) return
86-
if (store.debugMode) return false
8786
if (!store.autoRetries) return false
8887
if (customWhen) return customWhen(err)
8988
return true

test/unit/plugin/retryFailedStep_test.js

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -280,4 +280,39 @@ describe('retryFailedStep', () => {
280280
expect(counter).to.equal(1)
281281
expect(res).to.equal(false)
282282
})
283+
284+
it('should retry failed step when debugMode is enabled', async () => {
285+
// This test ensures that the retryFailedStep plugin works correctly
286+
// when store.debugMode is true, which happens with --verbose or --debug flags
287+
store.debugMode = true
288+
289+
try {
290+
retryFailedStep({ retries: 3, minTimeout: 1 })
291+
event.dispatcher.emit(event.test.before, createTest('test'))
292+
event.dispatcher.emit(event.step.started, { name: 'seeElement' })
293+
294+
let counter = 0
295+
await recorder.add(
296+
() => {
297+
counter++
298+
if (counter < 4) {
299+
throw new Error('Element not found')
300+
}
301+
return 'success'
302+
},
303+
undefined,
304+
undefined,
305+
true,
306+
)
307+
308+
const result = await recorder.promise()
309+
310+
// Should retry 3 times and succeed on 4th attempt
311+
expect(counter).to.equal(4)
312+
expect(result).to.equal('success')
313+
} finally {
314+
// Reset to default value
315+
store.debugMode = false
316+
}
317+
})
283318
})

0 commit comments

Comments
 (0)