Cypress / Quiz

Config Without Casualties

Four ways to feed Cypress an environment variable, one precedence order, and a secrets file that must never see git. Configuration is a battlefield too.

Difficulty
Easy
Format
Quiz
Points
100
Estimate
9 min

// MISSION BRIEF

Your Mission

A suite that hardcodes URLs and credentials dies the day you add a second environment. Cypress layers configuration: config file, cypress.env.json, CYPRESS_ variables, and --env flags, each overriding the last.

Six questions on wiring it correctly. Speed bonus active.

// FIRST CONTACT

Battle teaser

Inside a spec, custom environment values are read with:

  1. Awindow.env.apiUrl on the app under test
  2. BCypress.env('apiUrl'), which reads the merged env from all configured sources
  3. Ccy.env('apiUrl') as a queued command
  4. Dprocess.env.apiUrl, straight from Node
Answers, scoring, hints, and the full battle stay sealed.

// SKILL TAGS

cypressconfigurationciweb