Does cypress test suite have a way to unmask sensitive information in its output for debugging?

Viewed 57

Background: I am trying to run Cypress (npx cypress run) on Circle CI. I have used the Cypress Orb, though I recently expanded it to add more troubleshooting information. My set up is quite complex, with 5 containers spun up to provide the testing environment. So, I'm running it all in a Circle CI machine, not docker.

Problem: Cypress tests to see my baseUrl is alive and finds it is not, but I can separately prove it is alive by preceeding with a curl statement. All I can think of is that Cypress is not using the configured baseUrl, but I cannot tell what it is because it is masked, along with other sensitive information. I tried adding the -dev flag to the cypress commands, but still the information is masked.

Here is the relevant section of the "command" in my config.yml:

grep baseUrl cypress.json
echo -n "curl port 3091: "
curl -s -S -i localhost:3091 | grep -q 'HTTP/1.1 200 OK'
if [ $? -ne 0 ]; then
  echo "ran into an error"
  curl -i localhost:3091
else
  echo "OK"
fi
echo "cypress info:"
npx cypress info --dev
echo "run cypress"
set +e
npx cypress run --dev --browser chrome
if [ $? -ne 0 ]; then
  npx cypress run --browser chrome &> cypress-run.log
  echo "error, here is the cypress output:"
  cat cypress-run.log
  exit 1
fi

and here is the output from that code, executing on Circle CI:

baseUrl:   "baseUrl": "http://localhost:3091",
curl port 3091: OK
cypress info:

Proxy Settings: none detected
Environment Variables:
CYPRESS_testPassword: ********************
CYPRESS_baseUrl: *********************
CYPRESS_CACHE_FOLDER: ~/.cache/Cypress
CYPRESS_testUsername: *******************************************
CYPRESS_RECORD_KEY: <redacted>

Application Data: /home/circleci/.config/cypress/cy/development
Browser Profiles: /home/circleci/.config/cypress/cy/development/browsers
Binary Caches: /home/circleci/.cache/Cypress

Cypress Version: 6.8.0
System Platform: linux (Ubuntu - 20.04)
System Memory: 33.7 GB free 11.3 GB
run cypress
error, here is the cypress output:
Cypress could not verify that this server is running:

  > *********************

We are verifying this server because it has been configured as your `baseUrl`.

Cypress automatically waits until your server is accessible before running tests.

We will try connecting to it 3 more times...
We will try connecting to it 2 more times...
We will try connecting to it 1 more time...

Cypress failed to verify that your server is running.
Please start this server and then run Cypress again.
Exited with code exit status 1

Is there any way to unmask the output from Cypress? I've searched the Cypress documentation and done web searches and came up short.

1 Answers

Ok, lightbulb turned on so I can answer my own question.

  1. Cypress was not masking the output, Circle CI was doing that. This is the clue for #2.

  2. Circle CI was set up (not by me) to define the CYPRESS_baseUrl environment variable. It's value was used by Cypress to override the setting in the cypress.json file. And, the value in the environment variable was not correct!

Once I removed the environment variable, it started working.

Related