nightwatch.conf.js
require('nightwatch-cucumber')({
cucumberArgs: ['--require', 'step_definitions', '--format', 'json:reports/cucumber.json', 'features']
})
module.exports = {
'src_folders': ['tests'],
'page_objects_path': ['pages'],
'webdriver': {
'start_process': true,
'server_path': require('chromedriver').path,
'port': 9515
},
'test_settings': {
'default': {
'screenshots': {
'enabled': true,
'on_failure': true,
'on_error': true,
'path': 'tests_output/screenshots'
},
'desiredCapabilities': {
'browserName': 'chrome',
'chromeOptions': {
'w3c':'false'
}
}
}
}
};
这是我的 nightwatch.conf.js 文件,当我尝试运行我的测试时,它给出了以下错误
包.json
{
"name": "automation",
"version": "1.0.0",
"description": "",
"main": "nightwatch.js",
"scripts": {
"test": "echo "Error: no test specified" && exit 1",
"test:cucumber": "mkdirp report && cucumber-js --require cucumber.conf.js --require step-definitions --format node_modules/cucumber-pretty --format json:report/cucumber_report.json"
},
"keywords": [],
"author": "",
"license": "ISC",
"dependencies": {
"fs": "0.0.1-security",
"handlebars": "^4.3.1",
"path": "^0.12.7",
"run": "^1.4.0",
"selenium": "^2.20.0",
"selenium-server": "^3.141.59"
},
"devDependencies": {
"chromedriver": "^77.0.0",
"cucumber": "^5.1.0",
"cucumber-html-reporter": "^5.0.2",
"cucumber-pretty": "^1.5.2",
"mkdirp": "^0.5.1",
"nightwatch": "^1.2.4",
"nightwatch-api": "^2.3.0",
"nightwatch-cucumber": "^9.1.3"
}
}
错误:
自动化@1.0.0 测试:黄瓜 C:\Users\satheesh_g1\Desktop\Automation
mkdirp 报告 && cucumber-js --require cucumber.conf.js --require step-definitions --format node_modules/cucumber-pretty --format json:report/cucumber_report.json
VError:BeforeAll 挂钩出错,进程退出:cucumber.conf.js:15:在 C:\Users\Desktop\Automation\node_modules\cucumber\lib\runtime\index 处找不到模块 'nightwatch/lib/runner/run'。 js:68:19 在 Generator.next ()
我已经手动检查了失败的路径,我看不到运行模块。我也尝试安装 npm run (如果它存在的话)