Skip to content

Cypress tests failing in GitLab CICD Pipeline due to Environment variables. #14203

Answered by bahmutov
Sakshi3110 asked this question in CI setup
Discussion options

You must be logged in to vote

If you want to load and set different environment variables based on process.env values, you need to use the plugins file https://on.cypress.io/environment-variables#Option-5-Plugins

We have a recipe that shows several ways of setting and passing environment variables here https://github.com/cypress-io/cypress-example-recipes/tree/master/examples/server-communication__env-variables

And I have a section in my "Cypress tips and tricks" blog post specifically describing an example https://glebbahmutov.com/blog/cypress-tips-and-tricks/#pass-the-environment-variables-correctly

In your case the cypress/plugins/index.js file would have something like

module.exports = (on, config) => {
  const en…

Replies: 1 comment 1 reply

Comment options

You must be logged in to vote
1 reply
@Sakshi3110
Comment options

Answer selected by Sakshi3110
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
2 participants