diff --git a/.travis.yml b/.travis.yml index 4d981fd9..4ad395a0 100644 --- a/.travis.yml +++ b/.travis.yml @@ -6,7 +6,15 @@ env: - GIT_NAME: "'Couscous auto deploy'" - GIT_EMAIL: couscous@couscous.io - GH_REF: github.com/swisnl/jQuery-contextMenu + - SAUCE_USERNAME: "bbrala-contextmenu" - secure: XaE2bPODLwmzaNAKv9pA8mMiXJc8OrpyrO5tIGuOCwfQ+q7hx6Xa/tTcyn5+H2g+xYyJ0Qqv5+SDkDxbbgaVJLR1VEW15KEcZbD/3speqkg+yIC/oFxgbf1Ib01f0FowR2cw4/5Y2XzCM8CU7UxOLFGBDDCvM39Ab3UUl4uB/8g= + - secure: UOse3txRLxLQKsPVQf6OKZZP3c0nLaPJ+4G2vR/qJqBXCTTCQ84+9qx9ih/40FDFcjVXwabJsdn0EhkqDw4h50OGdc58V1UfSbk7g1RiuvvRakOPTK0J9h7bEkBPb7QQXCvAVfOZ81DN6l5lMjmH1tiC2T/h/MNOLHPXsbzXElg= + +cache: + directories: + - node_modules + - documentation/vendor + matrix: include: - env: JQUERY=1 php=5.5 @@ -18,10 +26,10 @@ matrix: install: -- if [ "$JQUERY" ] ; then nvm install 6 && npm install && npm install jquery@$JQUERY && npm test ; fi +- if [ "$JQUERY" ] ; then nvm install 6 && npm install && npm install jquery@$JQUERY ; fi - if [ "$DOCUMENTATION" ] ; then cd documentation && composer global require couscous/couscous ; fi -script: if [ "$JQUERY" ] ; then npm test ; else /home/travis/.composer/vendor/bin/couscous travis-auto-deploy --php-version=5.5 ; fi +script: if [ "$JQUERY" ] ; then npm test && npm run test-sauce ; else /home/travis/.composer/vendor/bin/couscous travis-auto-deploy --php-version=5.5 ; fi deploy: provider: npm diff --git a/README.md b/README.md index 92ffdd53..adfd2422 100644 --- a/README.md +++ b/README.md @@ -9,6 +9,8 @@ $.contextMenu is a management facility for - you guessed it - context menus. It [documentation](http://swisnl.github.io/jQuery-contextMenu/docs.html) +[![Sauce Test Status](https://saucelabs.com/browser-matrix/bbrala-contextmenu.svg)](https://saucelabs.com/u/bbrala-contextmenu) + ## Dependencies ## * jQuery >=1.8.2 diff --git a/karma-saucelabs.conf.js b/karma-saucelabs.conf.js new file mode 100644 index 00000000..49c3267c --- /dev/null +++ b/karma-saucelabs.conf.js @@ -0,0 +1,88 @@ + +module.exports = function (config) { + if (!process.env.SAUCE_USERNAME || !process.env.SAUCE_ACCESS_KEY) { + console.log('Make sure the SAUCE_USERNAME and SAUCE_ACCESS_KEY environment variables are set.') + process.exit(1) + } + + var testedCapabilities = {}; + var browsers = []; + + var capabilities = { + 'Windows 7': { + 'internet explorer': ['11', '10', '9'], + }, + 'Windows 10': { + 'firefox': ['latest', 'latest-1', 'latest-2'], + 'chrome': ['latest', 'latest-1', 'latest-2'], + 'MicrosoftEdge': ['latest'] + }, + 'macOS 10.12': { + 'firefox': ['latest'], + 'chrome': ['latest'], + 'safari': ['latest'] + } + }; + + var buildDate = new Date().toISOString(); + for (var osVersion in capabilities) { + for (var browserKey in capabilities[osVersion]) { + for(var i=0; i< capabilities[osVersion][browserKey].length; i++){ + var browserVersion = capabilities[osVersion][browserKey][i]; + testedCapabilities[osVersion + ' ' + browserKey + ' ' + browserVersion] = { + base: 'SauceLabs', + platform: osVersion, + browserName: browserKey, + version: browserVersion, + name: osVersion + ' ' + browserKey + ' ' + browserVersion, + build: buildDate + }; + } + + + if(browsers.indexOf(browserKey) == -1){ + browsers.push(browsers); + } + } + } + + config.set({ + basePath: '', + + // frameworks to use + // available frameworks: https://npmjs.org/browse/keyword/karma-adapter + frameworks: ['qunit'], + + + // list of files / patterns to load in the browser + files: [ + + // dependencies + { pattern: 'node_modules/jquery/dist/jquery.js', watched: false, served: true, included: true }, + { pattern: 'src/jquery.ui.position.js', watched: false, served: true, included: true }, + { pattern: 'src/jquery.contextMenu.js', watched: false, served: true, included: true }, + + // test modules + 'test/unit/*.js' + ], + + + reporters: ['dots', 'saucelabs'], + port: 9876, + colors: true, + sauceLabs: { + testName: 'jQuery contextMenu saucelabs', + recordScreenshots: false, + connectOptions: { + port: 5757, + logfile: 'sauce_connect.log' + }, + public: 'public' + }, + // Increase timeout in case connection in CI is slow + captureTimeout: 600000, + customLaunchers: testedCapabilities, + browsers: Object.keys(testedCapabilities), + singleRun: true + }) +} diff --git a/karma.conf.js b/karma.conf.js index baec95cb..b99345fb 100644 --- a/karma.conf.js +++ b/karma.conf.js @@ -40,7 +40,7 @@ module.exports = function(config) { // test results reporter to use // possible values: 'dots', 'progress' // available reporters: https://npmjs.org/browse/keyword/karma-reporter - reporters: ['progress'], + reporters: ['dots'], // web server port diff --git a/package.json b/package.json index 22a31f06..857c752e 100644 --- a/package.json +++ b/package.json @@ -14,6 +14,7 @@ "doctoc": "^1.2.0", "gulp": "^3.9.1", "gulp-autoprefixer": "^3.1.1", + "gulp-clean-css": "^2.0.13", "gulp-concat": "~2.6.0", "gulp-consolidate": "^0.2.0", "gulp-csscomb": "^3.0.8", @@ -25,7 +26,6 @@ "gulp-jscs": "^3.0.2", "gulp-jshint": "^2.0.2", "gulp-load-plugins": "^1.3.0", - "gulp-clean-css": "^2.0.13", "gulp-qunit": "^1.5.0", "gulp-rename": "^1.2.2", "gulp-replace": "^0.5.4", @@ -37,6 +37,7 @@ "karma-chrome-launcher": "^2.0.0", "karma-phantomjs-launcher": "^1.0.2", "karma-qunit": "^1.2.1", + "karma-sauce-launcher": "^1.1.0", "lodash": "^4.16.4", "qunitjs": "^2.0.1", "wdio-dot-reporter": "0.0.6", @@ -85,6 +86,7 @@ "scripts": { "test": "npm run test-unit", "test-unit": "./node_modules/karma/bin/karma start", - "test-sauce": "./node_modules/.bin/wdio wdio.conf.js" + "test-sauce": "./node_modules/karma/bin/karma start karma-saucelabs.conf.js", + "test-accept": "./node_modules/.bin/wdio wdio.conf.js" } } diff --git a/test/unit/test-events.js b/test/unit/test-events.js index 049ee3d0..87bb53c7 100644 --- a/test/unit/test-events.js +++ b/test/unit/test-events.js @@ -12,7 +12,6 @@ function testQUnit(name, itemClickEvent, triggerEvent) { }); // before each test function createContextMenu(items, classname) { - console.info('Creating menu'); if(typeof(classname) == 'undefined'){ classname = 'context-menu'; } @@ -55,7 +54,6 @@ function testQUnit(name, itemClickEvent, triggerEvent) { // after each test function destroyContextMenuAndCleanup() { - console.info('Destroying menu'); $.contextMenu('destroy'); // clean up `#qunit-fixture` when testing in karma runner