I successfully integrated cucumber with nightwatch.js
.
Here is a snippet of my package.json file:
{
"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"
}
}
nightwatch config:
{
"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"
}
}
}
After running the test cases using yarn nightwatch, all scenarios and steps pass successfully. However, I encounter an issue where the application does not terminate with exit code 0 and displays the following message:
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.
Does anyone have insights into why this error is occurring?