(node:19502) UnhandledPromiseRejectionWarning: Unhandled promise rejection (rejection id: 1): TypeError: Cannot read property 'indexOf' of undefined

(node:19502) UnhandledPromiseRejectionWarning: Unhandled promise rejection (rejection id: 1): TypeError: Cannot read property 'indexOf' of undefined

我已将黄瓜与 nightwatch.js 集成。

我的 package.json 看起来像:-

{
  "name": "learning-nightwatch",
  "version": "1.0.0",
  "description": "learning nightwatch",
  "license": "UNLICENSED",
  "scripts": {
    "nightwatch": "nightwatch",
    "start": "bin/start",
    "stop": "bin/stop",
    "test": "bin/test"
  },
  "dependencies": {
    "lodash": "^4.17.4",
    "minimist": "^1.2.0",
    "nightwatch": "^0.9.16",
    "cucumber": "^3.1.0",
    "nightwatch-cucumber": "^8.2.9"
  }
}

夜视配置:-

{
    "src_folders": [null],
    "output_folder": "reports",
    "custom_commands_path": "",
    "custom_assertions_path": "",
    "page_objects_path": "./pageObjects",
    "globals_path": "",
    "test_settings": {
        "default": {
            "launch_url": "http://localhost:8083",
            "selenium_port": 4444,
            "selenium_host": "localhost",
            "screenshots": {
                "enabled": true,
                "on_failure": true,
                "on_error": true,
                "path": "./screenshots"
            },
            "desiredCapabilities": {
                "marionette": true,
                "javascriptEnabled": true,
                "acceptSslCerts": true,
                "browserName": "chrome",
                "chromeOptions": {
                    "args": ["start-fullscreen"]
                }
            },
            "silent": true
        },
        "firefox": {
            "desiredCapabilities": {
                "browserName": "firefox",
                "args": ["-headless"]
            }
        }
    },
    "selenium": {
        "start_process": true,
        "server_path": "./bin/lib/selenium-server-standalone-3.7.1.jar",
        "log_path": "",
        "port": 4444,
        "cli_args": {
            "webdriver.chrome.driver": "./bin/lib/chromedriver",
            "webdriver.gecko.driver": "./bin/lib/geckodriver"
        }
    }
}

当我 运行 使用 yarn nightwatch 测试用例时。它 运行 测试用例成功,但应用程序永远不会以退出代码 0 终止并显示以下消息:

4 scenarios (4 passed)
8 steps (8 passed)
0m05.510s
(node:19502) UnhandledPromiseRejectionWarning: Unhandled promise rejection (rejection id: 1): TypeError: Cannot read property 'indexOf' of undefined
(node:19502) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit code.

有人知道我为什么会收到这个错误吗?

我有3条建议: