Skip to content

Configuring cypress agents

Andrew Goldis edited this page May 2, 2020 · 2 revisions

Overriding cypress configuration file

Find cypress installation path

$ DEBUG=cypress:* cypress version

...
# here it is
cypress:cli Reading binary package.json from: /Users/agoldis/Library/Caches/Cypress/3.4.1/Cypress.app/Contents/Resources/app/package.json +0ms
...

In my case it is: /Users/agoldis/Library/Caches/Cypress/3.4.1/Cypress.app/Contents/Resources/app/

Change the default dashboard URL

$ cat /Users/agoldis/Library/Caches/Cypress/3.4.1/Cypress.app/Contents/Resources/app/packages/server/config/app.yml

...
# Replace this with a URL of the alternative dashboard
production:
  # api_url: "https://api.cypress.io/"
  api_url: "http://localhost:1234/"
...

Overriding cypress config file with a script (Windows-only)

The solution was contributed by @danielvianna

# Step 1: get installed cypress version, store as variable

cypress_version=$($PWD/cypress-cast/node_modules/.bin/cypress --version ls -l | tail -1 | awk '{print $NF}')
echo cypress version is "$cypress_version"

# Step 2: get the binary path, store as variable

cypress_cache_path=$(npx print-cachedir Cypress)
echo cypress cache patch is "$cypress_cache_path"

# Step 4: define config path ending

cypress_server_config_path_ending='Cypress\resources\app\packages\server\config\'
echo config path ending is "${cypress_server_config_path_ending}"

# Step 5: concatenate all parts of the path into one, then transform into variable

cypress_server_config_fullpath="$cypress_cache_path"'\'"${cypress_version}"'\'"${cypress_server_config_path_ending}"

echo full path is $cypress_server_config_fullpath

tput setaf 4; echo current app.yml content is
cat "$cypress_server_config_fullpath/app.yml"

# Step 6: Copy new app.yml config and Replace the old cypress's app.yml

cp -f "$PWD/app.yml" "$cypress_server_config_fullpath/app.yml"
tput setaf 2; echo modified app.yml content is
cat "$cypress_server_config_fullpath/app.yml"

:End
cmd /k