sha*_*ger 2 automated-tests web-testing npm e2e-testing testcafe
我在OsX上,使用节点10.1.5.3的nvm。Testscafe(不在线)工作正常,但我试图按照Testcafe-live上的说明进行操作
在解释如何在本地安装的步骤
如果您已经在本地将testcafe-live安装到项目中,请在package.json中添加一个npm脚本以运行测试:
它指的是package.json文件,我在脚本部分下添加了条目
"scripts": {
"test": "eslint ./**/*.js",
"testcafe-live": "testcafe-live chrome tests/"
},
Run Code Online (Sandbox Code Playgroud)
但是当我跑步时
npm运行testcafe-live
我得到这些错误:
npm ERR! path /Users/Thomas.Pavan/testcafe/package.json
npm ERR! code ENOENT
npm ERR! errno -2
npm ERR! syscall open
npm ERR! enoent ENOENT: no such file or directory, open '/Users/Thomas.Pavan/testcafe/package.json'
npm ERR! enoent This is related to npm not being able to find a file.
npm ERR! enoent
npm ERR! A complete log of this run can be found in:
npm ERR! /Users/Thomas.Pavan/.npm/_logs/2019-03-11T14_58_28_946Z-debug.log
Run Code Online (Sandbox Code Playgroud)
我看到package.json路径存在问题,我的package.json文件位于〜/ testcafe / node_modules / testcafe-live中,但是npm正在查看/Users/Thomas.Pavan/testcafe/。如果将testcafe-live安装在项目根文件夹的错误位置(当前位于〜/ testcafe)中,我会感到困惑,而且我也不知道在哪里可以更改错误中显示的路径。长话短说,package.json文件应位于我的文件夹的根目录中,但请按照说明安装testcafe-live,创建一个node_modules文件夹,并将package.json文件嵌套在该文件夹中。
感谢您对TestCafe的关注。从版本1.0.0开始,TestCafe具有内置的实时模式功能,不需要任何外部模块。您提到的存储库现在已过时。请参考以下文章以获取更多详细信息https://devexpress.github.io/testcafe/documentation/using-testcafe/common-concepts/live-mode.html