Unable to pass CYPRESS_RECORD_KEY as env variable from cypress.env.json #27735
Replies: 5 comments 2 replies
-
I have the same problem today. Anyone know the solution? |
Beta Was this translation helpful? Give feedback.
-
@itkhanz Does test recording succeed or fail if you pass it in as a parameter in your run script? |
Beta Was this translation helpful? Give feedback.
-
It succeeds if I pass it in as a parameter in my run script. I just never
got it work using the explanation:
You can also set the key as an environment variable with the name:
CYPRESS_RECORD_KEY
…On Thu, Feb 22, 2024 at 3:06 PM Sam E. Lawrence ***@***.***> wrote:
@itkhanz <https://github.com/itkhanz> Does test recording succeed or fail
if you pass it in as a parameter in your run script?
—
Reply to this email directly, view it on GitHub
<#27735 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AYQNQMHLJEEQENBIWSSOAE3YU7FQ5AVCNFSM6AAAAAA4JON5AKVHI2DSMVQWIX3LMV43SRDJONRXK43TNFXW4Q3PNVWWK3TUHM4DKNRSGU2DE>
.
You are receiving this because you commented.Message ID:
***@***.***>
--
Richard Lyman
|
Beta Was this translation helpful? Give feedback.
-
I want to call Currently, I am reading /.env like this:
This works for other CYPRESS_ vars, but not the CYPRESS_RECORD_KEY... why not? If I set the var system wide, it still doesnt take when calling echo $CYPRESS_RECORD_KEY shows the var, but cypress doesnt see it? Where are we supposed to safely store the Hardcoded in the package.json? Hardcoded in the cypress.config.js? Can yall support .env files? |
Beta Was this translation helpful? Give feedback.
-
I am sure there are other ways to accomplish this, but I read the .env file in a separate script and executed the script in my package.json. .env script at project root: execute_script_with_Cypress_Record_key.ts
package.json
|
Beta Was this translation helpful? Give feedback.
-
Hi,
I am running locally cypress version 13.0 and trying to pass the
CYPRESS_RECORD_KEY
as environment variable stored in externalcypress.env.json
file in the root directoy of the project.In my cypress.env.json, i have defined the projectId and cypress record key as follows:
when I run tests from command line via
npx cypress run --record
, I get the errorI read the documentation and it states that the CYPRESS_RECORD_KEY can also be passed as environment variable, so I used cypress.env.json to pass it as environment variable. I even checked from cypress test runner app and I can see this environment variable there but running the tests give me above error.
https://docs.cypress.io/guides/cloud/getting-started
https://docs.cypress.io/guides/guides/environment-variables#Option-2-cypressenvjson
https://docs.cypress.io/guides/references/error-messages#You-passed-the---record-flag-but-did-not-provide-us-your-Record-Key
There is also a stack overflow issue created for similar issue, but there is no working solution:
https://stackoverflow.com/questions/74129938/add-cypress-dashboard-record-key-in-cypress-config-file
Could you please look into this issue, and help me pass the record key locally as environment variable from cypress.env.json file?
Beta Was this translation helpful? Give feedback.
All reactions