bright-noon-82211
01/29/2023, 3:08 PMroot/
.env
.git
frontend/
src/
cypress/
.env -> The CYPRESS_RECORD_KEY variable is located here
cypress.config.ts
package.json
backend/
...
In the cypress.config.ts I added this to load the correct .env:
dotenv.config({ path: `.env` });
dotenv.config();
And now when I run cypress using npm run cypress-test which runs cypress run --record
I get the error You passed the --record flag but did not provide us your Record Key.
Can I get any help?
- I tried adding the dotenv setup into plugins/index.ts
- I tried adding the variables to cypress.env.json in the frontend folder.
The only thing that seems to work is passing the env variables in the run command it self.bright-noon-82211
01/29/2023, 3:26 PMlet res = dotenv.config({ path: `.env`});
console.log(res.parsed);
I got the correct output, meaning dotenv was successfully loading the env variables:
{
REACT_APP_STAGE: 'compose',
REACT_APP_DASHBOARD_VERSION: 'local',
REACT_APP_MOBILE_REDIRECT: 'false',
DISABLE_ESLINT_PLUGIN: 'true',
SKIP_PREFLIGHT_CHECK: 'true',
CYPRESS_RECORD_KEY: 'xxxxx',
CYPRESS_API_URL: 'https://cy.currents.dev',
CYPRESS_BASE_URL: 'https://xxxxxx.com/'
}