Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/javascript/428.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Javascript Can';我不能运行我的测试。代码和包Json看起来是正确的_Javascript_Testing_E2e Testing_Testcafe_Browser Automation - Fatal编程技术网

Javascript Can';我不能运行我的测试。代码和包Json看起来是正确的

Javascript Can';我不能运行我的测试。代码和包Json看起来是正确的,javascript,testing,e2e-testing,testcafe,browser-automation,Javascript,Testing,E2e Testing,Testcafe,Browser Automation,刚开始在TestCafe接受新工作的培训 由于某种原因,我不断地出现以下错误,我不知道为什么 ERROR The specified glob pattern does not match any file or the default test directories are empty. Type "testcafe -h" for help. npm ERR! code ELIFECYCLE npm ERR! errno 1 npm ERR! testcafe_training@1.0.

刚开始在TestCafe接受新工作的培训

由于某种原因,我不断地出现以下错误,我不知道为什么

ERROR The specified glob pattern does not match any file or the default test directories are empty.

Type "testcafe -h" for help.
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! testcafe_training@1.0.0 test: `testcafe chrome ./test`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the testcafe_training@1.0.0 test script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.

npm ERR! A complete log of this run can be found in:
npm ERR!     /Users/xx.xxx/.npm/_logs/2020-01-17T15_15_38_725Z-debug.log
xxx.xx@LPGxxx TestCafe_Training % 
下面是代码和package.json

代码:

Fixture`Testcafe入门`
.第页`https://devexpress.github.io/testcafe/example/`;
Test('My first testcafe Test',async t=>{
//在这里输入您的测试用例
等待t.typetext(“#开发者名称”、“玛丽”);
等待t。单击(#提交按钮”);
});
package.json:

{
  "name": "testcafe_training",
  "version": "1.0.0",
  "description": "This is training",
  "main": "TestCafeTrain.js",
  "scripts": {
    "test": "testcafe chrome ./test"
  },
  "keywords": [
    "TestCafe",
    "Automation",
    "Testing"
  ],
  "author": "",
  "license": "ISC",
  "dependencies": {
    "testcafe": "^1.7.1"
  }
}

好吧,我知道我做错了什么

  • 包json中“test”的正确语法。我应该运行文件夹名并删除“/”

    “测试”:“testcafe chrome测试规范”

  • 在实际测试中,测试用例中有一个输入错误。我打字不正确。这就是它应该看起来的样子:

    等待t.typeText(“#开发者名称”,“玛丽”)


  • 运行此代码后,它工作正常

    如果您阅读了错误,您将看到它不工作的原因。您还没有告诉TestCafe您的测试位于何处。这是否回答了您的问题?