Closed guylabs closed 12 years ago
Btw: We use Linux (Ubuntu and CentOS)
Weird, that's how it should work - all the browsers that were started by testacular (through config browsers), should be killed once testacular is killed.
It works fine on my Mac as well as on Ubuntu.
Could you run it with --log-level=debug
and send the log debug output ?
Thanks for your answer and here is the log output with firefox:
guy@guyworklaptop ~/D/testacular> testacular config.js --log-level=debug
debug (watcher): Resolved files:
/usr/lib/node_modules/testacular/adapter/lib/jasmine.js
/usr/lib/node_modules/testacular/adapter/jasmine.js
/home/guy/Downloads/testacular/Test.spec.js
info: Web server started at http://localhost:9876
info (launcher): Starting browser "Firefox"
debug (launcher): /usr/bin/firefox -profile /home/guy/.mozilla/firefox/6sdfg1j3.testacular http://localhost:9876/?id=1
debug (web server): serving: /usr/lib/node_modules/testacular/static/client.html
debug (web server): serving: /usr/lib/node_modules/testacular/static/testacular.js
debug: New browser has connected on socket r96fbcCGWmkPRKfQCa9T
info (Firefox 14.0): Connected on socket id r96fbcCGWmkPRKfQCa9T
debug: All browsers are ready, executing
debug (web server): serving: /usr/lib/node_modules/testacular/static/context.html
.
Firefox 14.0: Executed 1 of 1 SUCCESS (0.023 / 0.004 secs)
info: Disconnecting all browsers
debug: Waiting for child processes to finish
debug (launcher): Cleaning the profile at /home/guy/.mozilla/firefox/6sdfg1j3.testacular
guy@guyworklaptop ~/D/testacular>
That's weird, because "Cleaning the profile..." is callback when the original process (firefox-bin) exits.
It's kinda tricky to help with this, as I can't reproduce it. Can you double check which user runs testacular process and which runs the firefox-bin ?
We just tested it on our CI server and there it works without any problems. The user which starts testacular also starts firefox. I think it's ok when it runs on the CI server by now.
Thanks for your quick answers.
I'm seeing the same problem running locally on Windows 7:
"C:\Program Files\nodejs\node.exe" ..\..\..\..\AppData\Roaming\npm\node_modules\testacular\bin\testacular start --log-level=debug config\testacular-e2e-vs.conf.js
info: Web server started at http://localhost:9876/
debug (launcher): Creating temp dir at C:\Users\FREDER~1\AppData\Local\Temp/testacular-1
info (launcher): Starting browser "PhantomJS"
debug (launcher): "C:\Program Files (x86)\PhantomJS\phantomjs.exe" C:\Users\FREDER~1\AppData\Local\Temp/testacular-1/capture.js
debug (watcher): Resolved files:
C:/Users/FrederikNS/AppData/Roaming/npm/node_modules/testacular/adapter/lib/angular-scenario.js
C:/Users/FrederikNS/AppData/Roaming/npm/node_modules/testacular/adapter/angular-scenario.js
C:/Users/FrederikNS/Programming/Visual Studio 2012/TabulexEvaluationDatabase/TabulexEvaluationDatabase/test/e2e/scenarios.js
debug (web server): serving: C:/Users/FrederikNS/AppData/Roaming/npm/node_modules/testacular/static/client.html
debug (web server): serving: C:/Users/FrederikNS/AppData/Roaming/npm/node_modules/testacular/static/testacular.js
debug: New browser has connected on socket GGLXv56gpbE8eLsX7jta
info (PhantomJS 1.6): Connected on socket id GGLXv56gpbE8eLsX7jta
debug: All browsers are ready, executing
debug (web server): serving: C:/Users/FrederikNS/AppData/Roaming/npm/node_modules/testacular/static/context.html
debug (web server): serving: C:/Users/FrederikNS/AppData/Roaming/npm/node_modules/testacular/adapter/angular-scenario.js
debug (web server): serving: C:/Users/FrederikNS/AppData/Roaming/npm/node_modules/testacular/adapter/lib/angular-scenario.js
debug (web server): serving: C:/Users/FrederikNS/Programming/Visual Studio 2012/TabulexEvaluationDatabase/TabulexEvaluationDatabase/test/e2e/scenarios.js
debug (proxy): Proxying request - /app/index.html to localhost:43015
debug (proxy): Proxying request - /app/css/app.css to localhost:43015
debug (proxy): Proxying request - /app/css/bootstrap/bootstrap.css to localhost:43015
debug (proxy): Proxying request - /app/css/bootstrap/bootstrap-responsive.css to localhost:43015
debug (proxy): Proxying request - /app/lib/jquery/jquery-1.8.1.js to localhost:43015
debug (proxy): Proxying request - /app/lib/bootstrap/bootstrap.js to localhost:43015
debug (proxy): Proxying request - /app/lib/angular/angular.js to localhost:43015
debug (proxy): Proxying request - /app/js/app.js to localhost:43015
debug (proxy): Proxying request - /app/js/services.js to localhost:43015
debug (proxy): Proxying request - /app/js/controllers.js to localhost:43015
debug (proxy): Proxying request - /app/js/filters.js to localhost:43015
debug (proxy): Proxying request - /app/js/directives.js to localhost:43015
debug (proxy): Proxying request - /app/partials/overview.html to localhost:43015
debug (proxy): Proxying request - /api/test to localhost:43015
PhantomJS 1.6: Executed 1 of 1
debug (proxy): Proxying request - /app/index.html to localhost:43015
debug (proxy): Proxying request - /app/partials/overview.html to localhost:43015
debug (proxy): Proxying request - /api/test to localhost:43015
debug (proxy): Proxying request - /app/partials/reports.html to localhost:43015
JS 1.6: Executed 2 of 2
debug (proxy): Proxying request - /app/index.html to localhost:43015
debug (proxy): Proxying request - /app/partials/overview.html to localhost:43015
debug (proxy): Proxying request - /api/test to localhost:43015
JS 1.6: Executed 3 of 3
JS 1.6: Executed 3 of 3 SUCCESS (0.481 secs / 0.373 secs)
info: Disconnecting all browsers
debug: Waiting for child processes to finish
debug (launcher): Cleaning the profile at C:\Users\FREDER~1\AppData\Local\Temp/testacular-1
Process finished with exit code 0
My config looks like this:
basePath = '../';
files = [
ANGULAR_SCENARIO,
ANGULAR_SCENARIO_ADAPTER,
'test/e2e/**/*.js'
];
autoWatch = false;
browsers = ['PhantomJS'];
singleRun = true;
proxies = {
'/': 'http://localhost:43015/'
};
My partner also experience this issue running on Linux Mint, also trying to run PhantomJS.
This is weird. Are you saying that even after Testacular closes, the browser is still open ?
I can't reproduce it (trying on Mac, Ubuntu). Your log looks correct to me.
THe "Cleaning the profile..." log is inside process exit handler, so at that point, the browser process should be already killed.
And even if Testacular didn't manage to kill it, once the node process (Testacular) is finished, system should kill all child processes as well (and it does so, at least on my machine).
Yes that is correct, the browser stays open even after testacular has finished. I agree it's pretty weird.
I recorded the issue so you might be able to get a better feel for it: http://youtu.be/v_qH-5h2JpU
Thanks for the video @FrederikNS
I've just learned, that my understanding of processes was wrong: If you kill a process, it DOES NOT kill its children, it changes their parent pid to 1.
So one explanation of this issue might be: The process started by testacular actually starts another process (and that's the actual browser). Eg, if you called "open" on Mac, it forks a new process with the browser in the background. (that's btw why we don't use "open" to start browsers, but we start the browser's binary directly). Are you using anything similar ? Maybe the chrome binary on Win starts chrome in a sub process.
So, if you use a custom script to launch the browser, you have to kill the process inside such a script.
I just tried on Win7 (virtual machine) and if you execute "C:.....path\to\chrome.exe" it immediately returns and start chrome in a child process. That's explanation why this happens.
Is there any Windows expert, who knows how to tell Windows to not do so ?
I can't reproduce this on any normal OS (Mac, Linux).
Fixed by 260a69961e990c0557f0cbeaa6da6aab13bafebf
Fantastic, it works perfectly for me.
Thank you Vojta! You're awesome!
Hi, I don't know if the following problem is related with this issue but with singleRun -> false my Chrome browser get closed by karma using "grunt test". Here it is my test/karma.conf.js:
...
browsers: [
'Chrome'
],
// Which plugins to enable
plugins: [
'karma-chrome-launcher',
'karma-phantomjs-launcher',
'karma-jasmine'
],
// Continuous Integration mode
// if true, it capture browsers, run tests and exit
singleRun: false,
...
Other details:
Other people experienced this behaviour or am I doing something of wrong?
This problem is still present. Running karma v0.12.28 karma-chrome-launcer 0.1.4 windows 7 64bit Chrome 37
:+1: also seeing this issue WinServer 2012 Karma 0.12.31 karma-chrome-launcher 0.1.7 Latest version of chrome
Also seeing this problem:
Linux 4.2.0-36-generic #42~14.04.1-Ubuntu SMP x86_64 GNU/Linux Karma 0.13.22 karma-chrome-launcher 0.1.12 Chromium 50.0.2661.102 Ubuntu 14.04
Same here Karma 0.13.33 karma-chrome-laquncher 2.00 Chrome 54 Linux Ubuntu 14.04
Is it possible to keep the browser open on purpose? An extra option for that behavior would be great. Also see https://stackoverflow.com/questions/45352256/how-to-keep-browser-window-open-for-single-karma-run-until-i-close-it-once
Same problem here. Karma 2.0.5
Here are my dev dependencies in package.json
:
"devDependencies": {
"autoprefixer": "^7.1.3",
"babel": "^6.23.0",
"babel-core": "^6.26.0",
"babel-loader": "^7.1.2",
"babel-plugin-transform-runtime": "^6.23.0",
"babel-polyfill": "^6.26.0",
"babel-preset-es2015": "^6.24.1",
"babel-preset-stage-0": "^6.24.1",
"bootstrap": "^3.3.7",
"bootstrap-colorpicker": "^2.5.2",
"bootstrap-select": "^1.12.4",
"chai": "^4.1.2",
"chai-spies": "^1.0.0",
"css-loader": "^0.28.5",
"esdoc": "^1.1.0",
"esdoc-importpath-plugin": "^1.0.2",
"esdoc-standard-plugin": "^1.0.0",
"eslint": "^5.0.1",
"eslint-config-google": "^0.9.1",
"extract-text-webpack-plugin": "^3.0.0",
"file-loader": "^0.11.2",
"font-awesome": "^4.7.0",
"highcharts": "^5.0.14",
"install": "^0.10.1",
"karma": "^2.0.2",
"karma-chai": "^0.1.0",
"karma-fixture": "^0.2.6",
"karma-html2js-preprocessor": "^1.1.0",
"karma-json-fixtures-preprocessor": "0.0.6",
"karma-mocha": "^1.3.0",
"karma-phantomjs-launcher": "^1.0.4",
"karma-sinon": "^1.0.5",
"karma-webpack": "^3.0.0",
"mocha": "^5.2.0",
"node-sass": "^4.5.3",
"npm": "^5.4.1",
"postcss-loader": "^2.0.6",
"precss": "^2.0.0",
"resolve-url-loader": "^2.1.0",
"sass-loader": "^6.0.6",
"sinon": "^5.1.0",
"style-loader": "^0.18.2",
"tether": "^1.4.0",
"uglify-js": "github:mishoo/UglifyJS2",
"uglifyjs-webpack-plugin": "^0.4.6",
"url-loader": "^0.5.9",
"webpack": "^3.5.5"
},
If we configure testacular to launch Chrome automatically and set to singleRun to true, the browser doesn't closes itself. The same for Firefox. Is this intentionally? Could you add some kind of a flag for this behavior?
Because we want to execute testacular on a CI server and we need to have it closed after a build.
Thanks and regards,
Guy