无法读取试图进行任何操作的源文件夹

Cannot read source folder attempting to make any action

当尝试 运行 我的守夜人项目 npm run project_one 时,我得到了这个回复。

There was an error while starting the test runner:

Error: Cannot read source folder: /Users/BenyJo/examples/tests
    at /Users/BenyJo/node_modules/nightwatch/lib/runner/run.js:203:21
    at /Users/BenyJo/node_modules/nightwatch/lib/runner/walk.js:97:18
    at FSReqWrap.oncomplete (fs.js:153:21)

npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! package@1.0.0 project_one: `nightwatch`
npm ERR! Exit status 1
npm ERR! 
npm ERR! Failed at the package@1.0.0 project_one script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.

每当我使用 npm 使用任何 nightwatch 命令时,我都会遇到同样的错误,我的 Nightwatch 配置如下:

{
  "src_folders" : ["tests"],
  "output_folder" : "reports",

  "selenium" : {
    "start_process" : true,
    "server_path" : "./bin/selenium_v360.jar",
    "log_path" : "",
    "port" : 4444,
    "cli_args" : {
      "webdriver.chrome.driver" : "./bin/chromedriver"
    }
  },

  "test_settings" : {
    "default" : {
      "launch_url" : "http://localhost",
      "selenium_port"  : 4444,
      "selenium_host"  : "localhost",
      "desiredCapabilities": {
        "browserName": "chrome",
        "javascriptEnabled": true,
        "acceptSslCerts": true
      }
    }
  }
}

我注意到在那个错误中,没有调用文件,那里应该有一个 nightwatch 文件夹。 /Users/BenyJo/examples/tests

有同样的问题,我的配置文件名有错字。它必须被命名为 "nightwatch.json"(我的被命名为 "nightwatch.js")。

['nightwatch', '--', '--group', "$testSuite", '--env', "$projectEnv"].

我已经解决了这个问题"Error: Cannot read source folder: /"

这两种方式执行命令:

nightwatch -- --group testSuite --env nameEnv
npm run test -- --group testSuite --env nameEnv


nightwatch -- --test testsFile/testSuite --env default

npm run test -- --test testsFile/testSuite --env default

记住双参数行:“-- --group”。

它以这种方式解决了 runner.js 执行 Nightwatch

您可以替换项目中的组或文件测试并查看 nighwatch.json 中的测试设置以解析参数 --env-e