Within my cypress.config.ts file, the configuration looks like this:
import { defineConfig } from "cypress";
export default defineConfig({
pageLoadTimeout: 360000,
defaultCommandTimeout: 60000,
env: {
EMAIL: "<a href="/cdn-cgi/l/email-protection" class="__cf_email__" data-cfemail="ed9f8c83898280ad808c8481c38e8280">[email protected]</a>",
PASSWORD: "password"
}
});
However, when attempting to use
cy.get("#emailField").type(Cypress.env('EMAIL'));
in my test, it consistently returns undefined. I have experimented by transferring the environment variables into a JSON file named cypress.env.json
, but this did not resolve the issue. Additionally, switching to javascript yielded the same result. Can anyone pinpoint what error I may be making?