Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Configuring environment variable in Cypress

Tags:

cypress

I am trying to set different environment for my test suite in Cypress. When I provide Cypress this dictionary as a JSON, Cypress throws error. Its unable to read the JSON (its unable to read users array (works fine without it)).

{
  "baseUrl": "https://staging-econsole.esihs.net/",
  "env": {
    "platform": "staging",
    "api_server": "https://pro.esiapi.io",
    "users": [
        {
            "name": "test01",
            "email": "[email protected]"

        },
        {
            "name": "test02",
            "email": "[email protected]"
        }
    ]

  }
}

Or can anyone suggest whats the best way to configure different users in Cypress. I have read there documentation and I want to configure different users via plugin.

like image 412
trickster Avatar asked Sep 12 '25 03:09

trickster


1 Answers

Environment variables are strings, so just pass in the stringified version of your object

like image 99
bkucera Avatar answered Sep 14 '25 19:09

bkucera



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!