Bird
0
0

You want to combine environment-specific config with test retries only in CI. How can you configure cypress.config.js to achieve this?

hard📝 Application Q9 of 15
Cypress - Test Organization and Patterns
You want to combine environment-specific config with test retries only in CI. How can you configure cypress.config.js to achieve this?
AUse a function in cypress.config.js that reads environment variables and returns config with retries set conditionally
BSet retries in every test file manually
CUse a separate config file for retries and merge manually
DRetries cannot be configured per environment
Step-by-Step Solution
Solution:
  1. Step 1: Understand conditional config

    cypress.config.js can export a function that reads env vars and returns config dynamically.
  2. Step 2: Apply conditional retries

    Inside the function, check if running in CI and set retries accordingly.
  3. Final Answer:

    Use a function in cypress.config.js that reads environment variables and returns config with retries set conditionally -> Option A
  4. Quick Check:

    Dynamic config function enables conditional retries [OK]
Quick Trick: Export config as function to set retries per environment [OK]
Common Mistakes:
  • Setting retries manually in each test file
  • Trying to merge separate config files manually
  • Believing retries cannot be environment-specific

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More Cypress Quizzes