docs/plugins/retryFailedStep.md
Retries each failed step in a test.
Add this plugin to config file:
plugins: {
retryFailedStep: {
enabled: true
}
}
Run tests with plugin enabled:
npx codeceptjs run --plugins retryFailedStep
retries - number of retries (by default 3),factor - The exponential factor to use. Default is 1.5.minTimeout - The number of milliseconds before starting the first retry. Default is 150.maxTimeout - The maximum number of milliseconds between two retries. Default is 10000.randomize - Randomizes the timeouts by multiplying with a factor from 1 to 2. Default is false.defaultIgnoredSteps - an array of steps to be ignored for retry. Includes:
amOnPagewait*send*execute*run*have*ignoredSteps - an array for custom steps to ignore on retry. Use it to append custom steps to ignored list.
You can use step names or step prefixes ending with *. As such, wait* will match all steps starting with wait.
To append your own steps to ignore list - copy and paste a default steps list. Regexp values are accepted as well.deferToScenarioRetries - when enabled (default), step retries are automatically disabled if scenario retries are configured to avoid excessive total retries.plugins: {
retryFailedStep: {
enabled: true,
ignoredSteps: [
'scroll*', // ignore all scroll steps
/Cookie/, // ignore all steps with a Cookie in it (by regexp)
]
}
}
This plugin can be disabled per test. In this case you will need to add step.retry() to all flaky steps:
Use scenario configuration to disable plugin for a test
Scenario('scenario tite', { disableRetryFailedStep: true }, () => {
// test goes here
})
config