How to Store Sensitive Data Like Username and Password For a Cypress Test

Let's say you want to test the login for an application. Here's how you'd go about storing username and password in Testery.

  1. Navigate to Environments Tab

  2. Add a new environment (if you don't have one)

  3. Add a variable for your sensitive data like password

  4. Enter name of variable (i.e. password) as CYPRESS_password and its value. For Cypress, you'll be able to access the value using Cypress.env('password') in your code (omitting the CYPRESS_ prefix)

  5. Click on "encrypt" checkbox (screenshot below)

  6. Save