"Connection refused! Is selenium server started?" error in VueJS Nightwatch E2E tests using ChromeDriver and Chrome - selenium

I have a VueJS app that has the default Nightwatch E2E tests. I just spent some time getting user accounts and auth set up. After doing so, when I try to run my E2E tests, they fail mysteriously. Here's the command line output I get:
code/premium-poker-tools [master●] » npm run e2e
> premium-poker-tools#1.0.0 e2e /Users/adamzerner/code/premium-poker-tools
> node test/e2e/runner.js
> Starting dev server...
Starting to optimize CSS...
> Listening at http://localhost:8080
Starting selenium server... started - PID: 58502
[BABEL] Note: The code generator has deoptimised the styling of "/Users/adamzerner/code/premium-poker-tools/test/e2e/specs/hit-calculator.js" as it exceeds the max of "500KB".
player
1
2
3
1) "before all" hook
0 passing (2s)
1 failing
1) player "before all" hook:
Connection refused! Is selenium server started?
npm ERR! code ELIFECYCLE
npm ERR! errno 10
npm ERR! premium-poker-tools#1.0.0 e2e: `node test/e2e/runner.js`
npm ERR! Exit status 10
npm ERR!
npm ERR! Failed at the premium-poker-tools#1.0.0 e2e script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.
npm ERR! A complete log of this run can be found in:
npm ERR! /Users/adamzerner/.npm/_logs/2019-05-23T19_47_08_016Z-debug.log
code/premium-poker-tools [master●] »
And here is /Users/adamzerner/.npm/_logs/2019-05-27T17_44_07_557Z-debug.log:
0 info it worked if it ends with ok
1 verbose cli [ '/usr/local/Cellar/node/11.11.0/bin/node',
1 verbose cli '/usr/local/bin/npm',
1 verbose cli 'run',
1 verbose cli 'e2e' ]
2 info using npm#6.9.0
3 info using node#v11.11.0
4 verbose run-script [ 'pree2e', 'e2e', 'poste2e' ]
5 info lifecycle premium-poker-tools#1.0.0~pree2e: premium-poker-tools#1.0.0
6 info lifecycle premium-poker-tools#1.0.0~e2e: premium-poker-tools#1.0.0
7 verbose lifecycle premium-poker-tools#1.0.0~e2e: unsafe-perm in lifecycle true
8 verbose lifecycle premium-poker-tools#1.0.0~e2e: PATH: /usr/local/lib/node_modules/npm/node_modules/npm-lifecycle/node-gyp-bin:/Users/adamzerner/code/premium-poker-tools/node_modules/.bin:/Library/Frameworks/Python.framework/Versions/3.6/bin:/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin:/Users/adamzerner/.rvm/bin
9 verbose lifecycle premium-poker-tools#1.0.0~e2e: CWD: /Users/adamzerner/code/premium-poker-tools
10 silly lifecycle premium-poker-tools#1.0.0~e2e: Args: [ '-c', 'node test/e2e/runner.js' ]
11 silly lifecycle premium-poker-tools#1.0.0~e2e: Returned: code: 10 signal: null
12 info lifecycle premium-poker-tools#1.0.0~e2e: Failed to exec e2e script
13 verbose stack Error: premium-poker-tools#1.0.0 e2e: `node test/e2e/runner.js`
13 verbose stack Exit status 10
13 verbose stack at EventEmitter.<anonymous> (/usr/local/lib/node_modules/npm/node_modules/npm-lifecycle/index.js:301:16)
13 verbose stack at EventEmitter.emit (events.js:197:13)
13 verbose stack at ChildProcess.<anonymous> (/usr/local/lib/node_modules/npm/node_modules/npm-lifecycle/lib/spawn.js:55:14)
13 verbose stack at ChildProcess.emit (events.js:197:13)
13 verbose stack at maybeClose (internal/child_process.js:984:16)
13 verbose stack at Process.ChildProcess._handle.onexit (internal/child_process.js:265:5)
14 verbose pkgid premium-poker-tools#1.0.0
15 verbose cwd /Users/adamzerner/code/premium-poker-tools
16 verbose Darwin 18.6.0
17 verbose argv "/usr/local/Cellar/node/11.11.0/bin/node" "/usr/local/bin/npm" "run" "e2e"
18 verbose node v11.11.0
19 verbose npm v6.9.0
20 error code ELIFECYCLE
21 error errno 10
22 error premium-poker-tools#1.0.0 e2e: `node test/e2e/runner.js`
22 error Exit status 10
23 error Failed at the premium-poker-tools#1.0.0 e2e script.
23 error This is probably not a problem with npm. There is likely additional logging output above.
24 verbose exit [ 10, true ]
For one, the Connection refused! Is selenium server started? error seems wrong. Above that it says Starting selenium server... started - PID: 58502, and I see a Chrome browser pop up very briefly and then immediately close.
Here is the code for the before block in question:
before(function (browser, done) {
console.log(1);
equityCalculator = browser.page['equity-calculator']();
console.log(2);
equityCalculator.navigate();
console.log(3);
browser.pause(20000);
equityCalculator
.waitForElementVisible('#app', 50000, function () {
console.log(4);
browser.resizeWindow(1440, 852, function () {
console.log(5);
done();
});
})
;
});
I've been trying to pin down where the problem occurs, but I'm having a lot of trouble. 1, 2, and 3 get logged out, but not 4 or 5, so that helps. But if 3 gets logged out, why isn't browser.pause(20000) working?
I've also been trying to mess around in my actual code to see where the issue is. I tried some alert statements in main.js to try to pinpoint the issue:
// The Vue build version to load with the `import` command
// (runtime-only or standalone) has been set in webpack.base.conf with an alias.
alert(1);
window.$ = require('jquery');
require('bootstrap');
alert(2);
import Vue from 'vue';
import store from '#/store';
import App from './App';
import router from './router';
import monkeyPatches from '#/services/monkey-patches';
import axios from 'axios';
import VueAxios from 'vue-axios';
alert(3);
Vue.config.productionTip = false
Vue.use(VueAxios, axios);
axios.interceptors.request.use(
function(config) {
config.withCredentials = true;
return config;
},
function(error) {
return Promise.reject(error);
}
);
/* eslint-disable no-new */
new Vue({
el: '#app',
router: router,
store: store,
template: '<App/>',
components: { App }
});
$(function () {
$('[data-toggle="popover"]').popover();
});
// if (navigator.serviceWorker) {
// navigator.serviceWorker.register('/service-worker.js').catch(function() {
// console.log('Service worker registration failed.');
// });
// }
But weirdly, alert(1) isn't even working. So I feel at a loss. From what I understand, the top of main.js is the "beginning" of a Vue app, and if it's not even reaching that point, what is going on? equityCalculator = browser.page['equity-calculator'](); and equityCalculator.navigate(); seem pretty standard. Here's a snippet of the page object:
module.exports = {
url: 'http://localhost:8080/equity-calculator',
elements: {
'app': '#app',
When I start my dev server and go to that url, it totally works. And my E2E tests were all working perfectly before I implemented user accounts and auth, I didn't change this file, and yet now I'm having the issue.
I'm not sure where I can go from here. Help!
Update:
Excerpt from package.json:
{
...
"dependencies": {
...
"chromedriver": "^2.45.0",
"cross-spawn": "^6.0.5",
"nightwatch": "^0.9.21",
"selenium-server": "^3.141.59",
},
}
Here's nightwatch.conf.js:
require('babel-register')
let config = require('../../config')
// http://nightwatchjs.org/gettingstarted#settings-file
module.exports = {
src_folders: ['test/e2e/specs'],
output_folder: 'test/e2e/reports',
custom_assertions_path: ['test/e2e/custom-assertions'],
page_objects_path: 'test/e2e/page-objects',
globals_path: 'test/e2e/globals.js',
test_runner : 'mocha',
selenium: {
start_process: true,
server_path: require('selenium-server').path,
host: '127.0.0.1',
port: 4444,
cli_args: {
'webdriver.chrome.driver': require('chromedriver').path
}
},
test_settings: {
default: {
selenium_port: 4444,
selenium_host: 'localhost',
silent: true,
globals: {
devServerURL: 'http://localhost:' + (process.env.PORT || config.dev.port),
handStrings: [
'aa', 'aks', 'aqs', 'ajs', 'ats', 'a9s', 'a8s', 'a7s', 'a6s', 'a5s', 'a4s', 'a3s', 'a2s',
'ako', 'kk', 'kqs', 'kjs', 'kts', 'k9s', 'k8s', 'k7s', 'k6s', 'k5s', 'k4s', 'k3s', 'k2s',
'aqo', 'kqo', 'qq', 'qjs', 'qts', 'q9s', 'q8s', 'q7s', 'q6s', 'q5s', 'q4s', 'q3s', 'q2s',
'ajo', 'kjo', 'qjo', 'jj', 'jts', 'j9s', 'j8s', 'j7s', 'j6s', 'j5s', 'j4s', 'j3s', 'j2s',
'ato', 'kto', 'qto', 'jto', 'tt', 't9s', 't8s', 't7s', 't6s', 't5s', 't4s', 't3s', 't2s',
'a9o', 'k9o', 'q9o', 'j9o', 't9o', '99', '98s', '97s', '96s', '95s', '94s', '93s', '92s',
'a8o', 'k8o', 'q8o', 'j8o', 't8o', '98o', '88', '87s', '86s', '85s', '84s', '83s', '82s',
'a7o', 'k7o', 'q7o', 'j7o', 't7o', '97o', '87o', '77', '76s', '75s', '74s', '73s', '72s',
'a6o', 'k6o', 'q6o', 'j6o', 't6o', '96o', '86o', '76o', '66', '65s', '64s', '63s', '62s',
'a5o', 'k5o', 'q5o', 'j5o', 't5o', '95o', '85o', '75o', '65o', '55', '54s', '53s', '52s',
'a4o', 'k4o', 'q4o', 'j4o', 't4o', '94o', '84o', '74o', '64o', '54o', '44', '43s', '42s',
'a3o', 'k3o', 'q3o', 'j3o', 't3o', '93o', '83o', '73o', '63o', '53o', '43o', '33', '32s',
'a2o', 'k2o', 'q2o', 'j2o', 't2o', '92o', '82o', '72o', '62o', '52o', '42o', '32o', '22',
],
}
},
chrome: {
desiredCapabilities: {
browserName: 'chrome',
javascriptEnabled: true,
acceptSslCerts: true
}
},
firefox: {
desiredCapabilities: {
browserName: 'firefox',
javascriptEnabled: true,
acceptSslCerts: true
}
}
}
}
And for Java/JDK:
code/premium-poker-tools-api [master] » java --version
java 9.0.4
Java(TM) SE Runtime Environment (build 9.0.4+11)
Java HotSpot(TM) 64-Bit Server VM (build 9.0.4+11, mixed mode)
When I look in my Java Control Panel, it says that I'm up to date.
I'm not sure how to figure out which Selenium version or Chrome version I'm using. For Chrome, if I open up Chrome and go to "About Google Chrome" it says 74.0.3729.169, the up to date one, and I assume my tests are using that same version.

This log message...
Starting selenium server... started - PID: 58502
and the subsequent error message...
Connection refused! Is selenium server started?
...implies that the WebDriver instance i.e. ChromeDriver though initiated but was unable to communicate with the WebBrowsing i.e. Chrome session.
Some more details about the:
Selenium version.
JDK version.
Selenium Server mode (Standalone/Grid).
ChromeDriver version.
Chrome version.
Would have helped us to debug the issue in a better way. However as you have mentioned "1, 2, and 3 get logged out, but not 4 or 5", possibly the issue stems out from the following code block:
equityCalculator
.waitForElementVisible('#app', 50000, function () {
console.log(4);
browser.resizeWindow(1440, 852, function () {
console.log(5);
done();
});
})
Reason
As per the discussion Connection refused! Is selenium server started nightwatch on edge your main issue seems to be incompatibility between the version of the binaries you are using.
Solution
Upgrade JDK to recent levels JDK 8u212.
Upgrade Selenium to current levels Version 3.141.59.
Upgrade ChromeDriver to ChromeDriver v74.0 level.
Upgrade Chrome version to Chrome v74 levels. (as per ChromeDriver v74.0 release notes)
Clean your Project Workspace through your IDE and Rebuild your project with required dependencies only.
If your base Web Client version is too old, then uninstall it and install a recent GA and released version of Web Client.
Take a System Reboot.
Execute your #Test.
Always invoke driver.quit() within tearDown(){} method to close & destroy the WebDriver and Web Client instances gracefully.
Outro
'Connection refused! Is selenium server started?\n' while running Nightwatch.js tests against Selenium Grid
Resolution
updating npm resolved the issue (as per OP's comments)
npm update

Related

CoreUi - why nightwatch cannot run e2e tests?

I want to start working with CoreUi Admin template and create project containing unit and e2e testing.
In the begining, I install CoreUi like shown in documentation:
git clone https://github.com/coreui/coreui-free-vue-admin-template.git CoreUI-Vue
cd CoreUI-Vue
npm install
Everything is ok. Now I want to run whole unit and e2e tests:
npm run test:unit
npm run test:e2e
All unit tests run properly. But when I run e2e test I got the following errors:
> #coreui/coreui-free-vue-admin-template#3.1.4 test:e2e
> vue-cli-service test:e2e
INFO Starting development server...
[BABEL] Note: The code generator has deoptimised the styling of /home/bagsiur/Projects/B2B/test-coreui/CoreUI-Vue/node_modules/#coreui/vue/dist/coreui-vue.common.js as it exceeds the max of 500KB.
WARNING Compiled with 2 warnings 2:47:38 PM
warning
asset size limit: The following asset(s) exceed the recommended size limit (244 KiB).
This can impact web performance.
Assets:
css/app.10fee0d6.css (383 KiB) js/chunk-28d6db65.e7636129.js (488 KiB)
js/chunk-2d0a400c.650c6f3a.js (3.37 MiB) js/chunk-2d0ae5e6.22010046.js (390 KiB)
js/chunk-2d237b34.468fc7b7.js (1.36 MiB)
js/chunk-vendors.03b8fe62.js (687 KiB)
warning
entrypoint size limit: The following entrypoint(s) combined asset size exceeds the recommended limit (244 KiB). This can impact web performance.
Entrypoints:
app (1.07 MiB)
js/chunk-vendors.03b8fe62.js
css/app.10fee0d6.css
js/app.94002fbe.js
App running at:
- Local: http://localhost:8080/
- Network: http://172.31.33.121:8080/
App is served in production mode.
Note this is for preview or E2E testing only.
INFO Running end-to-end tests ...
[Test] Test Suite
=================
⚠ Error connecting to localhost on port 9515.
_________________________________________________
TEST FAILURE: 1 error during execution; 0 tests failed, 0 passed (348ms)
✖ test
An error occurred while retrieving a new session: "unknown error: Chrome failed to start: exited abnormally."
Error: An error occurred while retrieving a new session: "unknown error: Chrome failed to start: exited abnormally."
at endReadableNT (_stream_readable.js:1201:12)
at processTicksAndRejections (internal/process/task_queues.js:84:21)
Error: An error occurred while retrieving a new session: "unknown error: Chrome failed to start: exited abnormally." at endReadableNT (_stream_readable.js:1201:12)
at processTicksAndRejections (internal/process/task_queues.js:84:21)
SKIPPED:
- CoreUI Vue e2e tests
ERROR Error: Command failed: /home/bagsiur/Projects/B2B/test-coreui/CoreUI-Vue/node_modules/nightwatch/bin/nightwatch --config /home/bagsiur/Projects/B2B/test-coreui/CoreUI-Vue/node_modules/#vue/cli-plugin-e2e-nightwatch/nightwatch.config.js --env chrome
Error: Command failed: /home/bagsiur/Projects/B2B/test-coreui/CoreUI-Vue/node_modules/nightwatch/bin/nightwatch --config /home/bagsiur/Projects/B2B/test-coreui/CoreUI-Vue/node_modules/#vue/cli-plugin-e2e-nightwatch/nightwatch.config.js --env chrome
at makeError (/home/bagsiur/Projects/B2B/test-coreui/CoreUI-Vue/node_modules/execa/index.js:174:9)
at /home/bagsiur/Projects/B2B/test-coreui/CoreUI-Vue/node_modules/execa/index.js:278:16
at runMicrotasks (<anonymous>)
at processTicksAndRejections (internal/process/task_queues.js:97:5)
bagsiur#DESKTOP-718MBR1:~/Projects/B2B/test-coreui/CoreUI-Vue$
bagsiur#DESKTOP-718MBR1:~/Projects/B2B/test-coreui/CoreUI-Vue$ npm run test:e2e
> #coreui/coreui-free-vue-admin-template#3.1.4 test:e2e
> vue-cli-service test:e2e
INFO Starting development server...
WARNING Compiled with 2 warnings 3:06:39 PM
warning
asset size limit: The following asset(s) exceed the recommended size limit (244 KiB).
This can impact web performance.
Assets:
css/app.10fee0d6.css (383 KiB)
js/chunk-28d6db65.e7636129.js (488 KiB)
js/chunk-2d0a400c.650c6f3a.js (3.37 MiB)
js/chunk-2d0ae5e6.22010046.js (390 KiB)
js/chunk-2d237b34.468fc7b7.js (1.36 MiB)
js/chunk-vendors.03b8fe62.js (687 KiB)
warning
entrypoint size limit: The following entrypoint(s) combined asset size exceeds the recommended limit (244 KiB). This can impact web performance.
Entrypoints:
app (1.07 MiB)
js/chunk-vendors.03b8fe62.js
css/app.10fee0d6.css
js/app.94002fbe.js
App running at:
- Local: http://localhost:8080/
- Network: http://172.31.33.121:8080/
App is served in production mode.
Note this is for preview or E2E testing only.
INFO Running end-to-end tests ...
[Test] Test Suite
=================
⚠ Error connecting to localhost on port 9515.
_________________________________________________
TEST FAILURE: 1 error during execution; 0 tests failed, 0 passed (348ms)
✖ test
An error occurred while retrieving a new session: "unknown error: Chrome failed to start: exited abnormally."
Error: An error occurred while retrieving a new session: "unknown error: Chrome failed to start: exited abnormally."
at endReadableNT (_stream_readable.js:1201:12)
at processTicksAndRejections (internal/process/task_queues.js:84:21)
Error: An error occurred while retrieving a new session: "unknown error: Chrome failed to start: exited abnormally." at endReadableNT (_stream_readable.js:1201:12)
at processTicksAndRejections (internal/process/task_queues.js:84:21)
SKIPPED:
- CoreUI Vue e2e tests
ERROR Error: Command failed: /home/bagsiur/Projects/B2B/test-coreui/CoreUI-Vue/node_modules/nightwatch/bin/nightwatch --config /home/bagsiur/Projects/B2B/test-coreui/CoreUI-Vue/node_modules/#vue/cli-plugin-e2e-nightwatch/nightwatch.config.js --env chrome
Error: Command failed: /home/bagsiur/Projects/B2B/test-coreui/CoreUI-Vue/node_modules/nightwatch/bin/nightwatch --config /home/bagsiur/Projects/B2B/test-coreui/CoreUI-Vue/node_modules/#vue/cli-plugin-e2e-nightwatch/nightwatch.config.js --env chrome
at makeError (/home/bagsiur/Projects/B2B/test-coreui/CoreUI-Vue/node_modules/execa/index.js:174:9)
at /home/bagsiur/Projects/B2B/test-coreui/CoreUI-Vue/node_modules/execa/index.js:278:16
at processTicksAndRejections (internal/process/task_queues.js:97:5)
I work on wsl2 and Debian. My node.js version is v13.14.0 and npm is 7.12.1. I installed chromedriver in version: ChromeDriver 2.41.578700 (2f1ed5f9343c13f73144538f15c00b370eda6706) and last stable google chrome: google-chrome-stable 90.0.4430.212-1
What do I miss? Where could be the cause of the error in running e2e tests?
#UPDATE: I put the configuration of Nightwatch.conf.json:
// http://nightwatchjs.org/gettingstarted#settings-file
const path = require('path')
const deepmerge = require('deepmerge')
const chromedriver = require('chromedriver')
// user may have not installed geckodriver
let geckodriver = {}
try {
geckodriver = require('geckodriver')
} catch (e) {}
const userOptions = JSON.parse(process.env.VUE_NIGHTWATCH_USER_OPTIONS || '{}')
const useSelenium = process.env.VUE_NIGHTWATCH_USE_SELENIUM === '1'
const startHeadless = process.env.VUE_NIGHTWATCH_HEADLESS === '1'
const concurrentMode = process.env.VUE_NIGHTWATCH_CONCURRENT === '1'
const chromeArgs = []
const geckoArgs = []
if (startHeadless) {
chromeArgs.push('headless')
geckoArgs.push('--headless')
}
const defaultSettings = {
src_folders: ['tests/e2e/specs'],
output_folder: 'tests/e2e/reports',
page_objects_path: 'tests/e2e/page-objects',
custom_assertions_path: 'tests/e2e/custom-assertions',
custom_commands_path: 'tests/e2e/custom-commands',
globals_path: path.resolve('tests/e2e/globals.js'),
test_workers: concurrentMode,
test_settings: {
default: {
detailed_output: !concurrentMode,
launch_url: '${VUE_DEV_SERVER_URL}'
},
chrome: {
desiredCapabilities: {
browserName: 'chrome',
chromeOptions: {
w3c: false,
args: chromeArgs
}
}
},
firefox: {
desiredCapabilities: {
browserName: 'firefox',
alwaysMatch: {
acceptInsecureCerts: true,
'moz:firefoxOptions': {
args: geckoArgs
}
}
},
webdriver: useSelenium ? {} : {
server_path: geckodriver.path,
port: 4444
}
}
}
}
const baseSettings = deepmerge(defaultSettings, webdriverServerSettings())
module.exports = deepmerge(baseSettings, adaptUserSettings(userOptions))
function adaptUserSettings (settings) {
// The path to nightwatch external globals file needs to be made absolute
// if it is supplied in an additional config file, due to merging of config files
if (settings.globals_path) {
settings.globals_path = path.resolve(settings.globals_path)
}
return settings
}
function webdriverServerSettings () {
if (useSelenium) {
return {
selenium: {
start_process: true,
host: '127.0.0.1',
port: 4444,
server_path: require('selenium-server').path,
cli_args: {
'webdriver.chrome.driver': chromedriver.path,
'webdriver.gecko.driver': geckodriver.path
}
}
}
}
return {
webdriver: {
start_process: true,
port: 9515,
server_path: chromedriver.path
}
}
}
Version mismatch of chromedriver and chrome is the most common reason of e2e failing like this.
ChromeDriver 2.41 supports Chrome v67-69
your google-chrome-stable 90.0.4430 needs ChromeDriver 90.0.4430

ng test --watch=false ERR code ELIFECYCLE when test fail

i have a problem, i don't think it's normal.
When i launch the command 'ng test --watch=false' with at least one test in error (wrong expect) the command quit with this error
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! ulys-nav#0.0.1 test: `ng test --watch=false`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the ulys-nav#0.0.1 test script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.
npm ERR! A complete log of this run can be found in:
npm ERR! /Users/martels3/.npm/_logs/2019-10-21T11_20_00_883Z-debug.log
But when i fix the test (correct expect), every is normal (without error).
Here is my karma.conf.js
const puppeteer = require('puppeteer');
process.env.CHROME_BIN = puppeteer.executablePath();
module.exports = function (config) {
config.set({
basePath: '',
frameworks: ['jasmine', '#angular-devkit/build-angular'],
plugins: [
require('karma-jasmine'),
require('karma-chrome-launcher'),
require('karma-jasmine-html-reporter'),
require('karma-coverage-istanbul-reporter'),
require('#angular-devkit/build-angular/plugins/karma')
],
client: {
clearContext: false, // leave Jasmine Spec Runner output visible in browser
jasmine: {
random: false
}
},
coverageIstanbulReporter: {
dir: require('path').join(__dirname, '../coverage'),
reports: ['html', 'lcovonly'],
fixWebpackSourcePaths: true
},
reporters: ['progress', 'kjhtml'],
port: 9876,
colors: true,
logLevel: config.LOG_INFO,
autoWatch: true,
browsers: ['Chrome', 'ChromeHeadless'],
customLaunchers: {
ChromeHeadlessCI: {
base: 'ChromeHeadless',
flags: ['--no-sandbox', '--disable-gpu']
}
},
singleRun: false,
captureTimeout: 210000,
browserDisconnectTolerance: 3,
browserDisconnectTimeout: 210000,
browserNoActivityTimeout: 210000
});
};
Is it normal to have this horrible error?
Because when i launch this command in the CI (bitRise), it quit because of this and i don't want to !
Maybe you still have the problem. I think I have the solution for you even if it's not the best one. The reason for this kind of problems is the configuration of the sourceMapproperty. If you search for the keyword in your project you will find it in angular.json and tsconfig.json
In angular.json is is set to false and in tsconfig.json it is true. While set to true the browser disconnects and the tests do not work. So the solution is to configure you command like this:
ng test --source-map=false --watch=false
For me this is the solution that helps because the sourceMap seems to be buggy. Related to this GitHub issue https://github.com/karma-runner/karma/issues/3267 and an explaination what sourceMaps are:
What will happen if sourcemap is set as false in Angular

Courgette - issue with running test

I'm trying to use Courgette to test an Angular web app. This is my first time so I started with a tutorial from here:
The thing is that I can't run even the built in test. this is my conf.js:
const path = require('path');
require('babel-core/register');
const specsPath = 'uiTests';
const outputPath = 'uiTestResult';
const cukeTractorPath = 'node_modules/cucumber-protractor/uiTestHelpers';
exports.pomConfig = {
outputPath,
timeoutInSeconds: 10,
pagesPath: path.resolve(specsPath, 'pages'),
componentsPath: path.resolve(specsPath, 'components'),
baseUrl: 'https://www.google.com/', // <------------ SET THE URL TO YOUR PROJECT HERE
};
exports.cucumberHtmlReporterConfig = {};
const cukeTags = process.env.cukeTags ? process.env.cukeTags.replace(',', ' or ') : '';
const protractorConfig = {
directConnect: true,
ignoreUncaughtExceptions: true,
framework: 'custom',
frameworkPath: require.resolve('protractor-cucumber-framework'),
specs: [
`${specsPath}/features/**/*.feature`,
],
capabilities: {
// acceptInsecureCerts: true, // uncomment to ignore SSL warnings
'shardTestFiles': !cukeTags && !process.env.linearise && !process.env.showStepDefinitionUsage,
'maxInstances': 4,
browserName: 'chrome',
chromeOptions: {
args: ['--window-size=1100,800'].concat(process.env.disableHeadless ? [] : ['--headless', '--disable-gpu']),
},
// 'browserName': 'firefox',
// 'moz:firefoxOptions': {
// args: [].concat(process.env.disableHeadless ? [] : ['-headless']),
// prefs: {
// 'general.useragent.override': 'Automated tests',
// },
// },
},
cucumberOpts: {
'require': [
// `${specsPath}/helpers/globals.js`,
`${cukeTractorPath}/globals.js`,
`${cukeTractorPath}/hooks/attachScenarioNameBefore.js`,
`${cukeTractorPath}/hooks/attachScreenshotAfter.js`,
`${cukeTractorPath}/hooks/pageObjectModelBefore.js`,
`${cukeTractorPath}/hooks/addMethodsBefore.js`,
`${cukeTractorPath}/hooks/setDefaultTimeout.js`,
`${cukeTractorPath}/stepDefinitions/*.js`,
`${specsPath}/stepDefinitions/*.js`,
// `${specsPath}/helpers/hooks.js`,
],
'tags': ['~ignore'].concat(cukeTags || []),
'format': [
'node_modules/cucumber-protractor/cucumberFormatter.js',
`json:./${outputPath}/report.json`,
].concat(process.env.showStepDefinitionUsage ? 'node_modules/cucumber/lib/formatter/usage_formatter.js' : []),
'profile': false,
'no-source': true,
},
onPrepare: () => { browser.ignoreSynchronization = true; },
};
exports.config = protractorConfig;
And this is the message from the terminal:
> c10#1.0.0 ct C:\Users\Melinda\Desktop\Protractor\c10
> set NODE_OPTIONS=--no-deprecation | cuketractor
Brm brm... off we go!
[09:04:34] I/launcher - Running 1 instances of WebDriver
[09:04:34] I/direct - Using ChromeDriver directly...
DevTools listening on ws://127.0.0.1:12249/devtools/browser/748be31e-7dd6-4f56-95d5-eba8122e4012
Test feature::: Clicking I’m Feeling Lucky without typing a search query goes straight to doodles
Getting full url: https://www.google.com/
Given I am on the 'Google Home' page ---> PASSED
[09:04:38] W/element - more than one element found for locator By(css selector, [name="btnI"]) - the first result will be used
When I click 'I’m Feeling Lucky' ---> FAILED
Then I expect the url to contain 'google.com/doodles' ---> SKIPPED
Screenshot of: Clicking I’m Feeling Lucky without typing a search query goes straight to doodles
*************************************
ScreenshotFilePath:
uiTestResult\Clicking-I’m-Feeling-Lucky-without-typing-a-search-query-goes-straight-to-doodles-1558944278600.png
*************************************
-------------------------------------
---FAIL---
[09:04:38] I/launcher - 0 instance(s) of WebDriver still running
[09:04:38] I/launcher - chrome #01 failed 1 test(s)
[09:04:38] I/launcher - overall: 1 failed spec(s)
[09:04:38] E/launcher - Process exited with error code 1
Cucumber HTML report C:\Users\Melinda\Desktop\Protractor\c10\uiTestResult\cucumberReport.html generated successfully.
------------------ Scenario Error --------------- Clicking I’m Feeling Lucky without typing a search query goes straight
to doodles
Tags: #google, #google-feeling-lucky
Step: When I click 'I’m Feeling Lucky'
Location: node_modules\cucumber-protractor\uiTestHelpers\stepDefinitions\commonWhenSteps.js:46
Feature: uiTests\features\google.feature:4
Error message: ElementNotVisibleError: element not visible
(Session info: headless chrome=74.0.3729.169)
(Driver info: chromedriver=2.35.528161 (5b82f2d2aae0ca24b877009200ced9065a772e73),platform=Windows NT 10.0.17134 x86_64)
at Object.checkLegacyResponse (C:\Users\Melinda\Desktop\Protractor\c10\node_modules\selenium-webdriver\lib\error.js:546:15)
at parseHttpResponse (C:\Users\Melinda\Desktop\Protractor\c10\node_modules\selenium-webdriver\lib\http.js:509:13)
at doSend.then.response (C:\Users\Melinda\Desktop\Protractor\c10\node_modules\selenium-webdriver\lib\http.js:441:30)
at process._tickCallback (internal/process/next_tick.js:68:7)
From: Task: WebElement.click()
at Driver.schedule (C:\Users\Melinda\Desktop\Protractor\c10\node_modules\selenium-webdriver\lib\webdriver.js:807:17)
at WebElement.schedule_ (C:\Users\Melinda\Desktop\Protractor\c10\node_modules\selenium-webdriver\lib\webdriver.js:2010:25)
at WebElement.click (C:\Users\Melinda\Desktop\Protractor\c10\node_modules\selenium-webdriver\lib\webdriver.js:2092:17)
at actionFn (C:\Users\Melinda\Desktop\Protractor\c10\node_modules\protractor\built\element.js:89:44)
at Array.map (<anonymous>)
at actionResults.getWebElements.then (C:\Users\Melinda\Desktop\Protractor\c10\node_modules\protractor\built\element.js:461:65)
at ManagedPromise.invokeCallback_ (C:\Users\Melinda\Desktop\Protractor\c10\node_modules\selenium-webdriver\lib\promise.js:1376:14)
at TaskQueue.execute_ (C:\Users\Melinda\Desktop\Protractor\c10\node_modules\selenium-webdriver\lib\promise.js:3084:14)
at TaskQueue.executeNext_ (C:\Users\Melinda\Desktop\Protractor\c10\node_modules\selenium-webdriver\lib\promise.js:3067:27)
at asyncRun (C:\Users\Melinda\Desktop\Protractor\c10\node_modules\selenium-webdriver\lib\promise.js:2927:27)
at C:\Users\Melinda\Desktop\Protractor\c10\node_modules\selenium-webdriver\lib\promise.js:668:7
at process._tickCallback (internal/process/next_tick.js:68:7)Error
at ElementArrayFinder.applyAction_ (C:\Users\Melinda\Desktop\Protractor\c10\node_modules\protractor\built\element.js:459:27)
at ElementArrayFinder.(anonymous function).args [as click] (C:\Users\Melinda\Desktop\Protractor\c10\node_modules\protractor\built\element.js:91:29)
at ElementFinder.(anonymous function).args [as click] (C:\Users\Melinda\Desktop\Protractor\c10\node_modules\protractor\built\element.js:831:22)
-----SCREENSHOT - hold cmd (on mac) and click .png below if using iterm ----
ScreenshotFilePath: uiTestResult\Clicking-I’m-Feeling-Lucky-without-typing-a-search-query-goes-straight-to-doodles-1558944278600.png
---------
┌─────────────────┬────────────┬──────────┐
│ Total Scenarios │ Successful │ Failures │
├─────────────────┼────────────┼──────────┤
│ 1 │ 0 │ 1 │
└─────────────────┴────────────┴──────────┘
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! c10#1.0.0 ct: `set NODE_OPTIONS=--no-deprecation | cuketractor`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the c10#1.0.0 ct script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.
npm ERR! A complete log of this run can be found in:
npm ERR! C:\Users\Melinda\AppData\Roaming\npm-cache\_logs\2019-05-27T08_04_38_705Z-debug.log
And my log file:
0 info it worked if it ends with ok
1 verbose cli [ 'C:\\Program Files\\nodejs\\node.exe',
1 verbose cli 'C:\\Users\\Melinda\\AppData\\Roaming\\npm\\node_modules\\npm\\bin\\npm-cli.js',
1 verbose cli 'run',
1 verbose cli 'ct' ]
2 info using npm#6.9.0
3 info using node#v10.15.3
4 verbose run-script [ 'prect', 'ct', 'postct' ]
5 info lifecycle c10#1.0.0~prect: c10#1.0.0
6 info lifecycle c10#1.0.0~ct: c10#1.0.0
7 verbose lifecycle c10#1.0.0~ct: unsafe-perm in lifecycle true
8 verbose lifecycle c10#1.0.0~ct: PATH: C:\Users\Melinda\AppData\Roaming\npm\node_modules\npm\node_modules\npm-lifecycle\node-gyp-bin;C:\Users\Melinda\Desktop\Protractor\c10\node_modules\.bin;C:\Program Files\Git\mingw64\bin;C:\Program Files\Git\usr\bin;C:\Users\Melinda\bin;C:\Program Files (x86)\Common Files\Oracle\Java\javapath;C:\Program Files (x86)\Intel\iCLS Client;C:\Program Files\Intel\iCLS Client;C:\WINDOWS\system32;C:\WINDOWS;C:\WINDOWS\System32\Wbem;C:\WINDOWS\System32\WindowsPowerShell\v1.0;C:\Program Files (x86)\Intel\Intel(R) Management Engine Components\DAL;C:\Program Files\Intel\Intel(R) Management Engine Components\DAL;C:\Program Files (x86)\Intel\Intel(R) Management Engine Components\IPT;C:\Program Files\Intel\Intel(R) Management Engine Components\IPT;C:\WINDOWS\System32\OpenSSH;C:\Program Files\dotnet;C:\Program Files\Microsoft SQL Server\130\Tools\Binn;C:\Program Files\Taurus\bin;C:\Program Files\Taurus\bin;C:\Program Files\Java\jdk-10.0.2\bin;C:\Program Files\Java\jre-10.0.2\bin;C:\Users\Melinda\Downloads\apache-jmeter-4.0\apache-jmeter-4.0\bin;C:\Users\Melinda\AppData\Local\Taurus\bin;C:\Program Files\Intel\WiFi\bin;C:\Program Files\Common Files\Intel\WirelessCommon;C:\Program Files\Git\cmd;C:\Program Files\nodejs;C:\Users\Melinda\AppData\Local\Programs\Microsoft VS Code\bin;C:\Users\Melinda\AppData\Roaming\npm
9 verbose lifecycle c10#1.0.0~ct: CWD: C:\Users\Melinda\Desktop\Protractor\c10
10 silly lifecycle c10#1.0.0~ct: Args: [ '/d /s /c',
10 silly lifecycle 'set NODE_OPTIONS=--no-deprecation | cuketractor' ]
11 silly lifecycle c10#1.0.0~ct: Returned: code: 1 signal: null
12 info lifecycle c10#1.0.0~ct: Failed to exec ct script
13 verbose stack Error: c10#1.0.0 ct: `set NODE_OPTIONS=--no-deprecation | cuketractor`
13 verbose stack Exit status 1
13 verbose stack at EventEmitter.<anonymous> (C:\Users\Melinda\AppData\Roaming\npm\node_modules\npm\node_modules\npm-lifecycle\index.js:301:16)
13 verbose stack at EventEmitter.emit (events.js:189:13)
13 verbose stack at ChildProcess.<anonymous> (C:\Users\Melinda\AppData\Roaming\npm\node_modules\npm\node_modules\npm-lifecycle\lib\spawn.js:55:14)
13 verbose stack at ChildProcess.emit (events.js:189:13)
13 verbose stack at maybeClose (internal/child_process.js:970:16)
13 verbose stack at Process.ChildProcess._handle.onexit (internal/child_process.js:259:5)
14 verbose pkgid c10#1.0.0
15 verbose cwd C:\Users\Melinda\Desktop\Protractor\c10
16 verbose Windows_NT 10.0.17134
17 verbose argv "C:\\Program Files\\nodejs\\node.exe" "C:\\Users\\Melinda\\AppData\\Roaming\\npm\\node_modules\\npm\\bin\\npm-cli.js" "run" "ct"
18 verbose node v10.15.3
19 verbose npm v6.9.0
20 error code ELIFECYCLE
21 error errno 1
22 error c10#1.0.0 ct: `set NODE_OPTIONS=--no-deprecation | cuketractor`
22 error Exit status 1
23 error Failed at the c10#1.0.0 ct script.
23 error This is probably not a problem with npm. There is likely additional logging output above.
24 verbose exit [ 1, true ]
I'm not even sure where the problem is. According to the error message the element in my 'When' section can't be found but chrome doesn't even open up in the first place.
Can anyone help with this?
It could either be that the sample was broken at the time or that your locale is different to en-gb and the text is wrong in the button. Isn't the most reliable of samples, needs to be changed to something more stable ideally, something hosted by courgette.

Nightwatch.js doesn't work on Linux server

I edited the question.
If someone can help me to understand why my test doesn't work, it would be very appreciated.
It seems to me that Selenium server starts and Chromedriver starts (please take a look at 'selenium-debug.log' section), but tests scripts are not executed.
My codes work on my Mac, but I don't know why they don't on a Linux server.
My codes are here: https://github.com/watarumohawk/nightwatchjs-e2e
On the server, node is v7.2.0, and npm is v4.0.5. So I installed these versions on my Mac, but I still can't reproduce the issue on my Mac.
On my Mac, 'npm run test:amazon' and 'node_modules/nightwatch/bin/nightwatch' work.
On the Linux server, I tried this:
node_modules/nightwatch/bin/nightwatch
$ node_modules/nightwatch/bin/nightwatch
Starting selenium server in parallel mode... started - PID: 29825
Started child process for: amazon/amazon-top
>> amazon/amazon-top finished.
npm run test:amazon
$ npm run test:amazon
> Nightwatch-e2e#1.1.0 test:amazon /home/foo/work/hoge/nightwatchjs-e2e
> nightwatch --group amazon
Starting selenium server in parallel mode... started - PID: 30066
Started child process for: amazon/amazon-top
>> amazon/amazon-top finished.
npm ERR! Linux 3.10.0-327.4.5.el7.x86_64
npm ERR! argv "/usr/local/bin/node" "/usr/local/bin/npm" "run" "test:amazon"
npm ERR! node v7.2.0
npm ERR! npm v4.0.5
npm ERR! code ELIFECYCLE
npm ERR! Nightwatch-e2e#1.1.0 test:amazon: `nightwatch --group amazon`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the Nightwatch-e2e#1.1.0 test:amazon script 'nightwatch --group amazon'.
npm ERR! Make sure you have the latest version of node.js and npm installed.
npm ERR! If you do, this is most likely a problem with the Nightwatch-e2e package,
npm ERR! not with npm itself.
npm ERR! Tell the author that this fails on your system:
npm ERR! nightwatch --group amazon
npm ERR! You can get information on how to open an issue for this project with:
npm ERR! npm bugs Nightwatch-e2e
npm ERR! Or if that isn't available, you can get their info via:
npm ERR! npm owner ls Nightwatch-e2e
npm ERR! There is likely additional logging output above.
npm ERR! Please include the following file with any support request:
npm ERR! /home/foo/work/hoge/nightwatchjs-e2e/npm-debug.log
Settings:
package.json
{
......
"scripts": {
"test": "nightwatch",
"test:amazon": "nightwatch --group amazon"
},
"dependencies": {
"chai-nightwatch": "^0.1.1",
"chromedriver": "^2.32.3",
"nightwatch": "^0.9.16",
"selenium-server-standalone-jar": "3.6.0"
},
"devDependencies": {}
}
nightwatch.json
{
"src_folders" : ["tests"],
"output_folder" : "reports",
"custom_commands_path" : "",
"custom_assertions_path" : "",
"page_objects_path" : "",
"globals_path" : "",
"test_workers" : {"enabled" : true, "workers" : "auto"},
"selenium" : {
"start_process" : true,
"server_path" : "node_modules/selenium-server-standalone-jar/jar/selenium-server-standalone-3.6.0.jar",
"log_path" : "",
"host" : "127.0.0.1",
"port" : 4444,
"cli_args" : {
"webdriver.chrome.driver" : "node_modules/chromedriver/lib/chromedriver/chromedriver",
"webdriver.ie.driver" : ""
}
},
"test_settings" : {
"default" : {
"launch_url" : "http://localhost",
"selenium_port" : 4444,
"selenium_host" : "localhost",
"silent": true,
"firefox_profile": false,
"chrome_driver" : "",
"screenshots" : {
"enabled" : true,
"path" : "screenshots",
"on_failure": true,
"on_error": false
},
"desiredCapabilities": {
"browserName": "chrome",
"javascriptEnabled": true,
"acceptSslCerts": true,
"chromeOptions": {
"args": ["--headless","--window-size=1920,1080"]
},
"use_xpath": false
}
}
}
}
Logs:
selenium-debug.log
15:31:22.180 INFO - Selenium build info: version: '3.6.0', revision: '6fbf3ec767'
15:31:22.180 INFO - Launching a standalone Selenium Server
2017-10-19 15:31:22.193:INFO::main: Logging initialized #159ms to org.seleniumhq.jetty9.util.log.StdErrLog
15:31:22.228 INFO - Driver class not found: com.opera.core.systems.OperaDriver
15:31:22.247 INFO - Driver provider class org.openqa.selenium.ie.InternetExplorerDriver registration is skipped:
registration capabilities Capabilities [{ensureCleanSession=true, browserName=internet explorer, version=, platform=WINDOWS}] does not match the current platform LINUX
15:31:22.247 INFO - Driver provider class org.openqa.selenium.edge.EdgeDriver registration is skipped:
registration capabilities Capabilities [{browserName=MicrosoftEdge, version=, platform=WINDOWS}] does not match the current platform LINUX
15:31:22.247 INFO - Driver provider class org.openqa.selenium.safari.SafariDriver registration is skipped:
registration capabilities Capabilities [{browserName=safari, version=, platform=MAC}] does not match the current platform LINUX
15:31:22.264 INFO - Using the passthrough mode handler
2017-10-19 15:31:22.281:INFO:osjs.Server:main: jetty-9.4.5.v20170502
2017-10-19 15:31:22.297:WARN:osjs.SecurityHandler:main: ServletContext#o.s.j.s.ServletContextHandler#eec5a4a{/,null,STARTING} has uncovered http methods for path: /
2017-10-19 15:31:22.300:INFO:osjsh.ContextHandler:main: Started o.s.j.s.ServletContextHandler#eec5a4a{/,null,AVAILABLE}
2017-10-19 15:31:22.310:INFO:osjs.AbstractConnector:main: Started ServerConnector#9660f4e{HTTP/1.1,[http/1.1]}{0.0.0.0:4444}
2017-10-19 15:31:22.311:INFO:osjs.Server:main: Started #278ms
15:31:22.311 INFO - Selenium Server is up and running
2017-10-19 15:31:22.528:INFO:osjshC.ROOT:qtp1910163204-11: org.openqa.selenium.remote.server.WebDriverServlet-28d25987: Initialising WebDriverServlet
15:31:22.552 INFO - Binding default provider to: org.openqa.selenium.chrome.ChromeDriverService
15:31:22.553 INFO - Found handler: org.openqa.selenium.remote.server.commandhandler.BeginSession#41c87be0
15:31:22.555 INFO - /session: Executing POST on /session (handler: BeginSession)
15:31:22.587 INFO - Capabilities are: Capabilities {acceptSslCerts=true, name=Amazon / Amazon Top, browserName=chrome, javascriptEnabled=true, use_xpath=false, chromeOptions={args=[--headless, --window-size=1920,1080]}, platformName=ANY, platform=ANY, }
15:31:22.587 INFO - Capabilities {acceptSslCerts=true, name=Amazon / Amazon Top, browserName=chrome, javascriptEnabled=true, use_xpath=false, chromeOptions={args=[--headless, --window-size=1920,1080]}, platformName=ANY, platform=ANY, } matched class org.openqa.selenium.remote.server.ServicedSession$Factory (provider: org.openqa.selenium.chrome.ChromeDriverService)
15:31:22.588 INFO - Capabilities {acceptSslCerts=true, name=Amazon / Amazon Top, browserName=chrome, javascriptEnabled=true, use_xpath=false, chromeOptions={args=[--headless, --window-size=1920,1080]}, platformName=ANY, platform=ANY, } matched class org.openqa.selenium.remote.server.ServicedSession$Factory (provider: org.openqa.selenium.chrome.ChromeDriverService)
15:31:22.588 INFO - Capabilities {acceptSslCerts=true, name=Amazon / Amazon Top, browserName=chrome, javascriptEnabled=true, use_xpath=false, chromeOptions={args=[--headless, --window-size=1920,1080]}, platformName=ANY, platform=ANY, } matched class org.openqa.selenium.remote.server.ServicedSession$Factory (provider: org.openqa.selenium.chrome.ChromeDriverService)
Starting ChromeDriver 2.33.506092 (733a02544d189eeb751fe0d7ddca79a0ee28cce4) on port 27120
Only local connections are allowed.
npm-debug.log
0 info it worked if it ends with ok
1 verbose cli [ '/usr/local/bin/node',
1 verbose cli '/usr/local/bin/npm',
1 verbose cli 'run',
1 verbose cli 'test:amazon' ]
2 info using npm#4.0.5
3 info using node#v7.2.0
4 verbose run-script [ 'pretest:amazon', 'test:amazon', 'posttest:amazon' ]
5 info lifecycle Nightwatch-e2e#1.1.0~pretest:amazon: Nightwatch-e2e#1.1.0
6 silly lifecycle Nightwatch-e2e#1.1.0~pretest:amazon: no script for pretest:amazon, continuing
7 info lifecycle Nightwatch-e2e#1.1.0~test:amazon: Nightwatch-e2e#1.1.0
8 verbose lifecycle Nightwatch-e2e#1.1.0~test:amazon: unsafe-perm in lifecycle true
9 verbose lifecycle Nightwatch-e2e#1.1.0~test:amazon: PATH: /usr/local/lib/node_modules/npm/bin/node-gyp-bin:/home/foo/work/hoge/nightwatchjs-e2e/node_modules/.bin:/home/foo/.pyenv/shims:/home/foo/.pyenv/bin:/usr/lib64/qt-3.3/bin:/usr/local/bin:/bin:/usr/bin:/usr/local/sbin:/usr/sbin:/home/foo/.local/bin:/home/foo/bin
10 verbose lifecycle Nightwatch-e2e#1.1.0~test:amazon: CWD: /home/foo/work/hoge/nightwatchjs-e2e
11 silly lifecycle Nightwatch-e2e#1.1.0~test:amazon: Args: [ '-c', 'nightwatch --group amazon' ]
12 silly lifecycle Nightwatch-e2e#1.1.0~test:amazon: Returned: code: 1 signal: null
13 info lifecycle Nightwatch-e2e#1.1.0~test:amazon: Failed to exec test:amazon script
14 verbose stack Error: Nightwatch-e2e#1.1.0 test:amazon: `nightwatch --group amazon`
14 verbose stack Exit status 1
14 verbose stack at EventEmitter.<anonymous> (/usr/local/lib/node_modules/npm/lib/utils/lifecycle.js:279:16)
14 verbose stack at emitTwo (events.js:106:13)
14 verbose stack at EventEmitter.emit (events.js:191:7)
14 verbose stack at ChildProcess.<anonymous> (/usr/local/lib/node_modules/npm/lib/utils/spawn.js:40:14)
14 verbose stack at emitTwo (events.js:106:13)
14 verbose stack at ChildProcess.emit (events.js:191:7)
14 verbose stack at maybeClose (internal/child_process.js:885:16)
14 verbose stack at Process.ChildProcess._handle.onexit (internal/child_process.js:226:5)
15 verbose pkgid Nightwatch-e2e#1.1.0
16 verbose cwd /home/foo/work/hoge/nightwatchjs-e2e
17 error Linux 3.10.0-327.4.5.el7.x86_64
18 error argv "/usr/local/bin/node" "/usr/local/bin/npm" "run" "test:amazon"
19 error node v7.2.0
20 error npm v4.0.5
21 error code ELIFECYCLE
22 error Nightwatch-e2e#1.1.0 test:amazon: `nightwatch --group amazon`
22 error Exit status 1
23 error Failed at the Nightwatch-e2e#1.1.0 test:amazon script 'nightwatch --group amazon'.
23 error Make sure you have the latest version of node.js and npm installed.
23 error If you do, this is most likely a problem with the Nightwatch-e2e package,
23 error not with npm itself.
23 error Tell the author that this fails on your system:
23 error nightwatch --group amazon
23 error You can get information on how to open an issue for this project with:
23 error npm bugs Nightwatch-e2e
23 error Or if that isn't available, you can get their info via:
23 error npm owner ls Nightwatch-e2e
23 error There is likely additional logging output above.
24 verbose exit [ 1, true ]

Protractor : ERROR - Unable to start a WebDriver session

I wrote test cases three months back at that time they worked fine now i want to run those test cases in another system so i did basic setup. When i try to run protractor test case now they are failing with 'Unable to start a WebDriver session'. I have tried so many solutions but they didn't work for me.
Here i am attaching my protractor.conf.js file and error details.
protractor.conf.js
'use strict';
exports.config = {
seleniumAddress: 'http://127.0.0.1:4444/wd/hub',
baseUrl: 'http://localhost:' + (process.env.PORT || '3036'),
chromeOnly: true,
// To get the maximimum test screen size
onPrepare: function() {
browser.driver.manage().window().maximize();
},
// list of files / patterns to load in the browser
specs: [
'e2e/attributeSection/search_spec.js', 'e2e/attributeSection/create_spec.js',
'e2e/attributeSection/edit_spec.js', 'e2e/attribute/search_spec.js',
'e2e/attribute/create_spec.js', 'e2e/attribute/edit_spec.js',
'e2e/classification/search_spec.js', 'e2e/classification/create_spec.js',
'e2e/classification/edit_spec.js', 'e2e/classificationGroup/create_spec.js',
'e2e/classificationGroup/edit_spec.js'
],
exclude: [],
capabilities: {
'browserName': 'chrome',
'chromeOptions': {
binary: 'C:/Program Files (x86)/Google/Chrome/Application/chrome.exe',
args: [],
extensions: [],
}
},
framework: 'jasmine',
jasmineNodeOpts: {
defaultTimeoutInterval: 60000
}
};
Error in console
Using the selenium server at http://127.0.0.1:4444/wd/hub
[launcher] Running 1 instances of WebDriver
ERROR - Unable to start a WebDriver session.
C:\Users\Cronj- 4\AppData\Roaming\npm\node_modules\protractor\node_modules\selenium-webdriver\http\index.js:145
callback(new Error(message));
^
Error: ECONNREFUSED connect ECONNREFUSED
at ClientRequest.<anonymous> (C:\Users\Cronj-4\AppData\Roaming\npm\node_modules\protractor\node_modules\selenium-webdriver\http\index.js:145:16)
at ClientRequest.emit (events.js:95:17)
at Socket.socketErrorListener (http.js:1552:9)
at Socket.emit (events.js:95:17)
at net.js:441:14
at process._tickCallback (node.js:442:13)
From: Task: WebDriver.createSession()
at Function.webdriver.WebDriver.acquireSession_ (C:\Users\Cronj-4\AppData\Roaming\npm\node_modules\protractor\node_modules\selenium-webdriver\lib\webdriver\webdriver.js:155:22)
at Function.webdriver.WebDriver.createSession (C:\Users\Cronj-4\AppData\Roaming\npm\node_modules\protractor\node_modules\selenium-webdriver\lib\webdriver\webdriver.js:129:30)
at [object Object].Builder.build (C:\Users\Cronj-4\AppData\Roaming\npm\node_modules\protractor\node_modules\selenium-webdriver\builder.js:416:22)
at [object Object].DriverProvider.getNewDriver (C:\Users\Cronj-4\AppData\Roaming\npm\node_modules\protractor\lib\driverProviders\driverProvider.js:38:7)
at [object Object].Runner.createBrowser (C:\Users\Cronj-4\AppData\Roaming\npm\node_modules\protractor\lib\runner.js:180:37)
at C:\Users\Cronj-4\AppData\Roaming\npm\node_modules\protractor\lib\runner.js:257:21
at _fulfilled (C:\Users\Cronj-4\AppData\Roaming\npm\node_modules\protractor\node_modules\q\q.js:797:54)
at self.promiseDispatch.done (C:\Users\Cronj-4\AppData\Roaming\npm\node_modules\protractor\node_modules\q\q.js:826:30)
at Promise.promise.promiseDispatch (C:\Users\Cronj-4\AppData\Roaming\npm\node_modules\protractor\node_modules\q\q.js:759:13)
Could anyone help me out? Thanks in advance
I believe the "chromeOnly" option got deprecated in v2.0.0.
chromeOnly: true,
This used to mean use "direct" mode without a selenium server. But since both firefox and chrome support direct mode, the property was renamed to "directConnect". So change that line to:
directConnect: true,
In this mode you don't need a selenium server, so you can drop the seleniumAddress property which is just confusing folks.
See https://github.com/angular/protractor/pull/1933/files
I ran webdriver-manager start in one command prompt and protractor in another command prompt then only test cases started running