Created
May 5, 2016 17:49
-
-
Save mehmetg/9b0be765ea92e0594dba3d5ee659df4c to your computer and use it in GitHub Desktop.
Protractor config with Sauce Labs build id and test name updates.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// https://github.com/angular/protractor/blob/master/docs/referenceConf.js | |
var q = require('q'); | |
var jasmineReporters = require('jasmine-reporters'); | |
exports.config = { | |
sauceUser: process.env.SAUCE_USERNAME, | |
sauceKey: process.env.SAUCE_ACCESS_KEY, | |
//seleniumAddress: 'http://ondemand.saucelabs.com:80/wd/hub', | |
specs: ['specs/*spec.js'], | |
restartBrowserBetweenTests: true, | |
framework: 'jasmine2', | |
getMultiCapabilities: function () { | |
var deferred = q.defer(); | |
var multiCaps = [{ | |
browserName: 'firefox', | |
version: '32', | |
platform: 'OS X 10.10', | |
name: "firefox-tests", | |
shardTestFiles: true, | |
maxInstances: 25 | |
}, { | |
browserName: 'chrome', | |
version: '41', | |
platform: 'Windows 7', | |
name: "chrome-tests", | |
shardTestFiles: true, | |
maxInstances: 25 | |
}]; | |
for (var i = 0; i < multiCaps.length; i++) { | |
multiCaps[i].build = process.env.BUILD_TAG; | |
} | |
deferred.resolve(multiCaps); | |
return deferred.promise; | |
}, | |
onPrepare: function() { | |
jasmine.getEnv().addReporter(new jasmineReporters.JUnitXmlReporter({ | |
consolidateAll: true, | |
savePath: 'testresults', | |
filePrefix: 'xmloutput' | |
})); | |
}, | |
onComplete: function () { | |
browser.getSession().then(function (session) { | |
return browser.getProcessedConfig().then(function (config) { | |
// config.capabilities is the CURRENT capability being run, if | |
// you are using multiCapabilities. | |
console.log('SauceOnDemandSessionID=' + session.getId() + ' job-name=' + config.capabilities.name); | |
return browser.get | |
}); | |
}); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment