diff --git a/Jenkinsfile b/Jenkinsfile index 3e6eb51..b405a0e 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -10,7 +10,11 @@ pipeline { } stage('Run Unit Tests') { steps { - echo 'npm run test-single-run' + sauce('e16593fe-6899-463b-9595-e5ba5eb46563') { + sauceconnect(options: '', sauceConnectPath: '') { + sh 'npm run test-single-run' + } + } } } stage('Deploy Application') { diff --git a/karma.conf.js b/karma.conf.js index 7271e9f..b87caa1 100644 --- a/karma.conf.js +++ b/karma.conf.js @@ -1,34 +1,75 @@ -//jshint strict: false module.exports = function(config) { + + // Browsers to run on Sauce Labs + var customLaunchers = { + 'SL_Chrome': { + base: 'SauceLabs', + browserName: 'chrome', + version: '48.0', + platform: 'Linux' + }, + 'SL_Firefox': { + base: 'SauceLabs', + browserName: 'firefox', + version: '50.0', + platform: 'Windows 10' + }, + 'SL_InternetExplorer': { + base: 'SauceLabs', + browserName: 'internet explorer', + version: '11.0', + platform: 'Windows 7' + }, + 'SL_Safari': { + base: 'SauceLabs', + browserName: 'safari', + platform: 'OS X 10.11', + version: '10.0' + } + }; + config.set({ - basePath: './app', + // base path that will be used to resolve all patterns (eg. files, exclude) + basePath: '', + + + // frameworks to use + // available frameworks: https://npmjs.org/browse/keyword/karma-adapter + frameworks: ['jasmine'], + + // list of files / patterns to load in the browser files: [ - 'bower_components/angular/angular.js', - 'bower_components/angular-route/angular-route.js', - 'bower_components/angular-mocks/angular-mocks.js', - 'components/**/*.js', - 'view*/**/*.js' + 'app/*.js', ], - autoWatch: true, - frameworks: ['jasmine'], + // test results reporter to use + // possible values: 'dots', 'progress' + // available reporters: https://npmjs.org/browse/keyword/karma-reporter + reporters: ['dots', 'saucelabs'], - browsers: ['Chrome'], - plugins: [ - 'karma-chrome-launcher', - 'karma-firefox-launcher', - 'karma-jasmine', - 'karma-junit-reporter' - ], + // web server port + port: 9876, - junitReporter: { - outputFile: 'test_out/unit.xml', - suite: 'unit' - } + colors: true, + + // level of logging + // possible values: config.LOG_DISABLE || config.LOG_ERROR || config.LOG_WARN || config.LOG_INFO || config.LOG_DEBUG + logLevel: config.LOG_INFO, + + sauceLabs: { + testName: 'Karma and Sauce Labs demo', + connectTunnel: false, + }, + captureTimeout: 120000, + customLaunchers: customLaunchers, + // start these browsers + // available browser launchers: https://npmjs.org/browse/keyword/karma-launcher + browsers: Object.keys(customLaunchers), + singleRun: true }); };