Bird
0
0

If your cypress.config.js has baseUrl: 'https://dev.example.com' and you run npx cypress run --config baseUrl=https://prod.example.com, what URL will cy.visit('/') open?

medium📝 Predict Output Q5 of 15
Cypress - Test Organization and Patterns
If your cypress.config.js has baseUrl: 'https://dev.example.com' and you run npx cypress run --config baseUrl=https://prod.example.com, what URL will cy.visit('/') open?
Ahttps://example.com/
Bhttps://dev.example.com/
Chttp://localhost/
Dhttps://prod.example.com/
Step-by-Step Solution
Solution:
  1. Step 1: Understand baseUrl override

    The CLI --config flag overrides the baseUrl set in cypress.config.js at runtime.
  2. Step 2: Determine final baseUrl

    Since --config baseUrl=https://prod.example.com is used, cy.visit('/') opens https://prod.example.com/
  3. Final Answer:

    https://prod.example.com/ -> Option D
  4. Quick Check:

    CLI config overrides baseUrl in config file [OK]
Quick Trick: CLI --config baseUrl overrides config file baseUrl [OK]
Common Mistakes:
  • Assuming config file baseUrl always used
  • Confusing baseUrl with cy.visit argument
  • Expecting localhost URL without explicit setting

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More Cypress Quizzes