我有一个用 vue 和 firebase/firestore 构建的应用程序。我使用 firebase 模拟器进行本地开发,并尝试将我的开发工作流程与 cypress 集成。但是,如果我从浏览器访问该应用程序,我会在 cypress 中收到错误消息。
Firebase CLI 版本为 7.9.0,Cypress 版本为“^3.8.0”
我用于加载所有内容的 npm 脚本如下:
"start": "firebase emulators:exec --only firestore \"npm run dev:appandtest\"",
"dev:appandtest": "concurrently -n \"app,test\" -c \"bgYellow.black,bgWhite.black\" \"npm:dev:app\" \"npm:dev:test\"",
"dev:app": "webpack-dev-server --config build/webpack.dev.js",
"dev:test": "npx cypress open",
Run Code Online (Sandbox Code Playgroud)
本地服务器在端口 9000 上运行,而 firebase 模拟器在端口 8080 上运行。
事情运行后,如果我从普通浏览器访问应用程序,一切都很好,如此屏幕所示。
普通的
然后我尝试使用此代码运行基本的柏树测试
describe('The Home Page', function () {
it('successfully loads', function () {
cy.visit('/');
});
});
Run Code Online (Sandbox Code Playgroud)
我收到以下错误消息:
[2019-12-14T15:29:24.725Z] @firebase/firestore: Firestore (6.6.2): Could not reach Cloud Firestore backend. Backend didn't …Run Code Online (Sandbox Code Playgroud) webapp2 firebase firebase-tools cypress google-cloud-firestore