Hello,
I searched in GitHub and StackOverflow but not able to found a solution. Other people seems to be have discussed similar issues before but closed. #301
Issue:
After tests are executed, the process stays and does not exit. I have to manually Ctrl+C to end it in the terminal.
Expected behavior:
It should end like a mocha test.
-- nightwatch setting
{
"src_folders":[
"test_nightwatch"
],
"output_folder":"reports",
"webdriver":{
"start_process":false,
"server_path":"/usr/bin/chromedriver",
"port":9515
},
"test_runner":{
"type":"mocha",
"options":{
"ui":"bdd",
"reporter":"list"
}
},
"test_settings":{
"default":{
"silent":true,
"desiredCapabilities":{
"browserName":"chrome",
"acceptSslCerts":true,
"chromeOptions":{
"args":[
"no-sandbox",
"headless",
"allow-running-insecure-content",
"ignore-certificate-errors",
"window-size=1280,720",
"allow-insecure-localhost"
]
}
}
}
}
}
- tests.js
describe('Subscription Page', function() {
var webServer;
before(function(client, done) {
webServer = server.app.listen(3000,function(){
done();
});
});
after(function(client, done) {
client.end(function() {
webServer.close(done);
});
});
afterEach(function(client, done) {
done();
});
beforeEach(function(client, done) {
done();
});
it('Home page can find surprise box', function(client) {
client
.url('http://localhost:3000')
.expect.element('body').to.be.present.before(10000);
});
}
-- terminal output
✓ Subscription Page Home page can find surprise box: 5247ms
1 passing (7s)
and it just sits here until I Ctrl C to end it.
I am closing this. It doesn't have any formatting at all, no verbose log, no indication of config, versions or platform. Life's too short to try and reproduce suspicious and incomplete bugs.
Although this is closed, I just experienced this issue as well.
My config:
{
"src_folders" : ["tests"],
"webdriver" : {
"start_process": true,
"server_path": "/usr/local/bin/chromedriver",
"port": 9515
},
"test_settings" : {
"default" : {
"launch_url": "http://localhost:7000",
"desiredCapabilities": {
"browserName": "chrome",
"chromeOptions": {
"args" : ["--headless"]
}
}
}
$ nightwatch -v
nightwatch v1.0.19
The issue I had was that I was using chromedriver inside my local node_modules directory which:
$ ./node_modules/.bin/chromedriver -v
ChromeDriver 2.46.628411 (3324f4c8be9ff2f70a05a30ebc72ffb013e1a71e)
Where as my globally installed chromedriver:
$ chromedriver -v
ChromeDriver 2.36.540469 (1881fd7f8641508feb5166b7cae561d87723cfa8)
worked fine once I had pointed nightwatch towards it in my config file.
Solved!
I was able to solve this issue just now by doing the following:
// nightwatch.conf.js (not using a json file for config either)
const chrome = require('chromedriver')
module.exports = {
src_folders: ['tests'],
webdriver: {
start_process: true,
server_path: chrome.path,
port: 9515,
},
test_settings: {
default: {
desiredCapabilities: {
browserName: 'chrome',
},
},
},
}
This now exits properly on completion on Windows.
Most helpful comment
Although this is closed, I just experienced this issue as well.
My config:
$ nightwatch -vnightwatch v1.0.19The issue I had was that I was using chromedriver inside my local
node_modulesdirectory which:$ ./node_modules/.bin/chromedriver -vChromeDriver 2.46.628411 (3324f4c8be9ff2f70a05a30ebc72ffb013e1a71e)Where as my globally installed chromedriver:
$ chromedriver -vChromeDriver 2.36.540469 (1881fd7f8641508feb5166b7cae561d87723cfa8)worked fine once I had pointed nightwatch towards it in my config file.