Reputation: 59
I'm currently developing e2e test for an angular application. Before running my test suites, I have to manually start backend(.net application) - my idea was to automate this undertaking.
I came across the node module opener and child_process. I wrote a file which I make npm execute in preprotractor. There are three further files, two of them move folders from a server to my desktop and the other makes a http post request to my backend.
The application opens up before my selenium standalone server is started. I then get the following error notification:
Starting selenium standalone server... [launcher] Running 1 instances of WebDriver Selenium standalone server started at http://10.0.1.56:62023/wd/hub [launcher] BUG: launcher exited with 1 tasks remaining
Does anyone of you have any ideas or tips of how to solve this problem?
Here is my package.json:
{
"name": "xxx",
"version": "0.0.0",
"description": "xxx",
"devDependencies": {
"bower": "^1.3.1",
"http-server": "^0.6.1",
"karma": "~0.10",
"karma-coverage": "~0.2.1",
"karma-junit-reporter": "^0.2.2",
"karma-ng-html2js-preprocessor": "^0.1.0",
"karma-requirejs": "^0.2.2",
"protractor": "^1.5.x",
"shelljs": "^0.2.6",
"jasmine-reporters": "^1.x",
"fs-extra": "^0.12.0",
"pix-diff": "^1.0.4",
"blink-diff": "^1.0.7"
},
"scripts": {
"postinstall": "bower install",
"prestart": "npm install",
"start": "http-server -a localhost -p 8000",
"pretest": "npm install",
"test": "karma start test/karma.conf.js",
"test-single-run": "karma start test/karma.conf.js --single-run",
"preupdate-webdriver": "npm install",
"update-webdriver": "webdriver-manager update",
"preprotractor": "npm run update-webdriver && node backend.js",
"protractor": "protractor test/protractor-conf.js",
"update-index-async": "node -e \"require('shelljs/global'); sed('-i', /\\/\\/@@NG_LOADER_START@@[\\s\\S]*\\/\\/@@NG_LOADER_END@@/, '//@@NG_LOADER_START@@\\n' + cat('app/bower_components/angular-loader/angular-loader.min.js') + '\\n//@@NG_LOADER_END@@', 'app/index-async.html');\""
}
}
Upvotes: 2
Views: 5277
Reputation: 2578
For me, it was calling process.exit()
from within my protractor.conf.js
, killing the process before protractor had cleaned itself up.
Upvotes: 0
Reputation: 11
If you have something like that than remove it from hooks
this.AfterFeatures(function() {
browser.close(); // not required
});
Upvotes: 1
Reputation: 55
it can be caused because callback function was not called in your test
this.Given(/^Step description$/, function (callback) {
// callback is not called
});
Upvotes: 1
Reputation: 6034
From the sound of it, your backend.js probably made a request to start the server, but never waited for it to start, since protractor is starting before your backend is ready.
What you want is probably (pseudo-code):
requestBackendStart();
while(backend.getState !== 'started') {
wait
}
to ensure that your backend is ready before you exit the script.
Upvotes: 0