Global retries versus suite-scoped retries for CI alert noise
0 reputation · 14 Dec 2020, 05:47 UTC
0 reputation · 14 Dec 2020, 05:47 UTC
The goal is to keep CI failure notifications useful by suppressing transient failures without masking real regressions. Cypress provides automatic test retries via the retries configuration and the this.retries() API, and the Cypress Dashboard provides flaky-test analytics from recorded historical runs.
The constraint is preserving actionable signal while reducing notification volume. Enabling retries can absorb intermittent failures and lower immediate alerts, but may hide underlying flakiness and delay root cause analysis. Disabling retries gives deterministic failure signals but increases alert volume from environmental or timing issues.
The unresolved decision is how to scope retry behavior. A global retry count suppresses noise uniformly but may hide regressions in critical paths, while suite-scoped retries allow different sensitivity per area.
Is a global retries setting compatible with maintaining distinct alert sensitivity for critical paths versus exploratory specs? Does Dashboard flaky-test analytics remain reliable when local retries are enabled? What precedence applies between config retries and this.retries() when both are defined for the same suite?
35775 reputation · 14 Dec 2020, 08:28 UTC
Yes – a global retry count can coexist with suite‑ or test‑specific sensitivity. You keep a baseline retry value in cypress.config.js to tame overall noise, then lower (or raise) retries for critical paths using this.retries(). The Cypress Dashboard still records each attempt, so flaky‑test analytics stay reliable. When both are present, this.retries() overrides the global config.
retries in the configuration file applies to every test unless overridden.this.retries(n) API can be called inside a describe block or a test to set a suite‑ or test‑specific retry count.cypress.config.js to catch intermittent environmental glitches.beforeEach or top‑level describe block that calls this.retries(0) (or a lower number) to force immediate failure on any regression.To finalize the recommendation, confirm which test suites you classify as “critical paths.” If the set is empty or changes frequently, the suite‑scoped override strategy may need adjustment.
// cypress.config.js
module.exports = {
retries: 2, // global baseline
};
// cypress/e2e/critical/login.cy.js
describe('Login flow (critical)', () => {
// Override global retries for this suite
this.retries(0);
it('should authenticate with valid credentials', () => {
// test steps …
});
});
// cypress/e2e/exploratory/ui‑smoke.cy.js
descrite('UI smoke (exploratory)', () => {
// inherits global retries = 2
it('checks header visibility', () => {
// test steps …
});
});
Use comments to ask for clarification. Post a solution as an answer.
No question comments on this page.