browser_capabilities.js 956 B

1234567891011121314151617181920212223242526272829303132
  1. var sauceBrowsers = require('./sauce_browsers.json');
  2. function getBrowserName(browserCap) {
  3. var name = browserCap.browserName == 'internet explorer' ?
  4. 'ie' :
  5. browserCap.browserName;
  6. var version = browserCap.version || '-latest';
  7. return name + version;
  8. }
  9. function getJobName(browserCap) {
  10. var browserName = getBrowserName(browserCap);
  11. return process.env.TRAVIS_PULL_REQUEST == 'false' ?
  12. 'CO-' + process.env.TRAVIS_BRANCH + '-' + browserName :
  13. 'PR-' + process.env.TRAVIS_PULL_REQUEST + '-' + browserName + '-' +
  14. process.env.TRAVIS_BRANCH;
  15. }
  16. function getBrowserCapabilities(browsers) {
  17. var caps = [];
  18. for (var i = 0; i < browsers.length; i++) {
  19. var b = browsers[i];
  20. b['tunnel-identifier'] = process.env.TRAVIS_JOB_NUMBER;
  21. b['build'] = process.env.TRAVIS_BUILD_NUMBER;
  22. b['name'] = getJobName(b);
  23. caps.push(b);
  24. }
  25. return caps;
  26. }
  27. module.exports = getBrowserCapabilities(sauceBrowsers);