Cypress load environment variables in custom commands #14957
Unanswered
janhesters
asked this question in
Questions and Help
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
I'm building a Next.js app and write my tests using Cypress. I configure the environment variables using a
.env.local
file locally.I'm trying to write a custom command in Cypress that encrypts a session in
cypress/support/command.ts
.When this command runs, it fails because
encryptSession
uses aTOKEN_SECRET
environment variable, that Cypress doesn't load.How can I get Cypress to load the environment variables from that file, if its runs locally (and from the CI's
env
key in the.yaml
file if its in the CI)?Beta Was this translation helpful? Give feedback.
All reactions