Configuring Cypress To Run On Different Environments

Setting up the Configuration Files

- ProjectFolder
-- cypress
--- configFiles
---- development.json
---- stage.json
---- production.json
-- fixtures
-- integration
--- specs
-- plugins
-- support
- package.json
- node.modules
- cypress.json

Telling Cypress About the Config Files

Setting up the Node Scripts

--env [environmentVariableName]= value
npm run cy:stage
npm run cy:production

Dynamically Switching Configuration Files, CI/CD

Results

npm run cy:development
npm run cy:production

Cypress.json

Conclusion

--

--

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store