Vue.js 设置Cypress IO以在类星体框架上与dotenv合作

Vue.js 设置Cypress IO以在类星体框架上与dotenv合作,vue.js,cypress,quasar-framework,dotenv,Vue.js,Cypress,Quasar Framework,Dotenv,我正在使用Quasar框架,在我添加了软件包之后,我意识到e2e测试不起作用 我尝试通过添加带有一些数据的test/Cypress/plugins/Cypress.env.json文件来设置Cypress环境,并按照建议更改同一文件夹中的test/Cypress/plugins/index.js文件: const env=require('quasar-dotenv').config() module.exports=(打开,配置)=>{ //config.env.API_URL='1〕htt

我正在使用Quasar框架,在我添加了软件包之后,我意识到e2e测试不起作用

我尝试通过添加带有一些数据的
test/Cypress/plugins/Cypress.env.json
文件来设置Cypress环境,并按照建议更改同一文件夹中的
test/Cypress/plugins/index.js
文件:

const env=require('quasar-dotenv').config()
module.exports=(打开,配置)=>{
//config.env.API_URL='1〕http://example.com“//不起作用
config.env=env
//Chrome::Hack for Shacking AUT.Cypress问题:https://github.com/cypress-io/cypress/issues/1620
on('before:browser:launch',(browser={},args)=>{
如果(browser.name=='chrome'){
args.push('--disable blink features=RootLayerScrolling');
返回args;
}
返回true;
});
返回配置
};
  • 卡塔利纳马科斯酒店
  • Cypress v3.5.0
  • 铬v77

    • 我不知道答案,因为我不熟悉类星体dotenv。您是否尝试过正式的quasar dotenv应用程序扩展?或者,另一个官方应用程序扩展,但没有dotenv包装那么固执己见:

      哦,有一个官方软件包。。。我想我找错地方了。。。是的,就是这样,现在可以用了。谢谢。事实证明,你用的那个是为类星体v0.17制造的
      Uncaught TypeError: fs.readFileSync is not a function
      
      This error originated from your test code, not from Cypress.
      
      When Cypress detects uncaught errors originating from your test code it will automatically fail the current test.
      
      Cypress could not associate this error to any specific test.
      
      We dynamically generated a new test to display this failure.
      
      Check your console for the stack trace or click this message to see where it originated from.
          at Object.config (http://localhost:8080/__cypress/tests?p=test/cypress/integration/home/init.spec.js-312:141291:34)
          at Object.746.eslint (http://localhost:8080/__cypress/tests?p=test/cypress/integration/home/init.spec.js-312:150393:36)
          at o (http://localhost:8080/__cypress/tests?p=test/cypress/integration/home/init.spec.js-312:1:265)
          at http://localhost:8080/__cypress/tests?p=test/cypress/integration/home/init.spec.js-312:1:316
          at Object.747.../../../../quasar.conf.js (http://localhost:8080/__cypress/tests?p=test/cypress/integration/home/init.spec.js-312:150535:35)
          at o (http://localhost:8080/__cypress/tests?p=test/cypress/integration/home/init.spec.js-312:1:265)
          at r (http://localhost:8080/__cypress/tests?p=test/cypress/integration/home/init.spec.js-312:1:431)
          at http://localhost:8080/__cypress/tests?p=test/cypress/integration/home/init.spec.js-312:1:460