(node:19502)UnhandledPromiseRejectionWarning:未处理的promise promise(拒绝id:1):TypeError:无法读取未定义的属性'indexOf'

时间:2017-11-13 08:21:52

标签: javascript selenium selenium-webdriver cucumber nightwatch.js

我已将黄瓜与{ "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" } } 整合在一起。

我的package.json看起来像: -

{
    "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"
        }
    }
}

nigtwatch配置: -

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.

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

{{1}}

任何人都知道我为什么会收到此错误?

1 个答案:

答案 0 :(得分:1)