赛普拉斯环境变量未定义

Art*_*rov 6 javascript automation node.js cypress

在 cypress.json 文件中我有以下代码

{
  "baseUrl": "test",
  "ignoreTestFiles": [],
  "viewportHeight": 768,
  "viewportWidth": 1024,
  "video": false,

  "env": { "email": "test@email.com", "password": "password" }
}
Run Code Online (Sandbox Code Playgroud)

当我尝试通过调用 Cypress.env('password') 来访问它时,它在打印时在控制台日志中显示未定义,这是什么问题。

const password: string = Cypress.env('password')

describe("Login to the application", () => {
  beforeEach(() => {
    cy.visit("/");
  });

  it.only("user should login successfully", () => {
    console.log(Cypress.env('email')).   --- undefined 
    loginPage.login(email, password);
    cy.url().should("include", "/wallet");
  });
Run Code Online (Sandbox Code Playgroud)

Art*_*rov 5

我的错误是不知道或没有检查 cypress.json 文件的位置,将其移动到顶部 cypress 文件夹,并且值正确显示。