问题
Please let me know if anyone have tried integration of protractor with Jenkins.
Regards,
Manan
回答1:
Integration with jenkins is relatively simple. The biggest hurdle is ensuring that the boxes which have Jenkins installed are up to date and have the required resources. If you want to test in Firefox on jenkins - you will need XVFB installed. Luckily for you, there is a plugin for that: https://wiki.jenkins-ci.org/display/JENKINS/Xvfb+Plugin
Running protractor protractor.js.conf will return a 0 or a 1 depending on success or failure. Run that command in shell script. Jenkins will take care of passing or failing the job depending on the outcome of the job.
Also using the junit output will incorporate nicely into jenkins, just make sure to setup the post build step to read it. I think it will output the xml files into the reports/ directory.
回答2:
Not that I can found.
The state of that integration is tracked by issue 60, which asks for a junit reporter (like karma has) so the status of the tests can be reported by Jenkins.
The only advice in that issue:
if you use Grunt as your build tool, you can run your Protractor tests using grunt-jasmine-node and configure it to get JUnit-like reports!
As Snekse adds in the comments:
You may also want to look into multi-configuration targets on Jenkins which let you run your build steps in parallel each with a clean environment.
It also has nifty features like touchstone builds and allows you to throttle concurrency better than grunt.
onPrepare: function(){
require('jasmine-reporters');
var capsPromise = browser.getCapabilities();
capsPromise.then(function(caps){
var browserName = caps.caps_.browserName.toUpperCase();
var browserVersion = caps.caps_.version;
var prePendStr = browserName + "-" + browserVersion + "-";
jasmine.getEnv().addReporter(new
jasmine.JUnitXmlReporter("protractor_output", true, true,prePendStr));
});
},
The all result can even be seen in an jintoppy/protractor-html-screenshot-reporter.
来源:https://stackoverflow.com/questions/20796877/how-to-setup-protractor-with-gitlab-and-jenkins