Sql 我可以在plugin/index.js文件中传递Cypress.env吗?
我已经创建了一个cypress“任务”来从数据库中获取数据,我不想在索引文件中存储configDB的凭据,而是想通过cypress.json传递它。Cypress.env不起作用有解决办法吗Sql 我可以在plugin/index.js文件中传递Cypress.env吗?,sql,sql-server,cypress,Sql,Sql Server,Cypress,我已经创建了一个cypress“任务”来从数据库中获取数据,我不想在索引文件中存储configDB的凭据,而是想通过cypress.json传递它。Cypress.env不起作用有解决办法吗 const configDB = { server: "xxx", port: xxx, domain: "US", user: "username", password: "password", database: "database
const configDB = {
server: "xxx",
port: xxx,
domain: "US",
user: "username",
password: "password",
database: "database",
driver: "tedious",
options: {
enableArithAbort: true,
},
};
const sql = require("mssql");
参考
在plugins/index.js
文件中,将其设置为config.env
:
module.exports = (on, config) => {
// `on` is used to hook into various events Cypress emits
// `config` is the resolved Cypress config
// modify env var value
config.env.ENVIRONMENT = 'dev';
// return config to update the global configuration
return config
}