Skip to content

Commit

Permalink
Switch to Browserstack, faster and currently more stable.
Browse files Browse the repository at this point in the history
  • Loading branch information
bbrala committed Dec 29, 2017
1 parent aa19813 commit fd3927c
Show file tree
Hide file tree
Showing 5 changed files with 271 additions and 31 deletions.
29 changes: 12 additions & 17 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -1,47 +1,42 @@
sudo: false

env:
global:
- GIT_NAME: "'Couscous auto deploy'"
- GIT_EMAIL: couscous@couscous.io
- GH_REF: github.com/swisnl/jQuery-contextMenu
- SAUCE_USERNAME: "bbrala-contextmenu"
- secure: "rEkgz8GHGUs0WDeuo1VPcQMAiO26dBs3b4dT1j67XtJEIHojcLNjjx2z434E+KaweuO0peWWmKFkT6ObZxJTnLd6xxyJjwhXERVaLNtwwlIxt20SpWCKFm5hOGFOwiCRP9pXK2vxWxnHKFJtGyX+pwDGjy0VtMF3ME8/KaHwfvs="
- SAUCE_USERNAME: bbrala-contextmenu
- BROWSERSTACK_USERNAME: bjrnbrala1
- secure: rEkgz8GHGUs0WDeuo1VPcQMAiO26dBs3b4dT1j67XtJEIHojcLNjjx2z434E+KaweuO0peWWmKFkT6ObZxJTnLd6xxyJjwhXERVaLNtwwlIxt20SpWCKFm5hOGFOwiCRP9pXK2vxWxnHKFJtGyX+pwDGjy0VtMF3ME8/KaHwfvs=
- secure: UOse3txRLxLQKsPVQf6OKZZP3c0nLaPJ+4G2vR/qJqBXCTTCQ84+9qx9ih/40FDFcjVXwabJsdn0EhkqDw4h50OGdc58V1UfSbk7g1RiuvvRakOPTK0J9h7bEkBPb7QQXCvAVfOZ81DN6l5lMjmH1tiC2T/h/MNOLHPXsbzXElg=
- secure: "CePtLNQdTmPszCvHt2nElOj+/hCi/Hyw4ujQGTZyj8stRCmsXqPXqvVdGwRkYCwVFsTAQYXKehozMgjXI6tULmS9nmMfBziCNKK1wGr5M8/UvqYp0mdT942dx1lzXpP5W/FcizFV7zTjCA6OhlXSz5UEaWL/bdBEKkFg0J+704U="
- COVERALLS_PARALLEL: true

cache:
directories:
- node_modules

matrix:
include:
- language: node_js
node_js: "8"
node_js: '8'
env: JQUERY=1
- language: node_js
node_js: "8"
node_js: '8'
env: JQUERY=2
- language: node_js
node_js: "8"
node_js: '8'
env: JQUERY=3
- language: php
php: 5.5
env: DOCUMENTATION=1
allow_failures:
- env: DOCUMENTATION=1

install:
- if [ "$JQUERY" ] ; then yarn add jquery@$JQUERY ; fi
- if [ "$DOCUMENTATION" ] ; then cd documentation && composer global require couscous/couscous ; fi

- if [ "$JQUERY" ] ; then yarn add jquery@$JQUERY ; fi
- if [ "$DOCUMENTATION" ] ; then cd documentation && composer global require couscous/couscous ; fi
script:
- if [ "$JQUERY" ] ; then yarn run test ; else /home/travis/.composer/vendor/bin/couscous travis-auto-deploy --php-version=5.5 ; fi
- if [ "$JQUERY" ] && [ "$SAUCE_USERNAME" ] ; then yarn run test-sauce ; fi

- if [ "$JQUERY" ] ; then yarn run test ; else /home/travis/.composer/vendor/bin/couscous travis-auto-deploy --php-version=5.5 ; fi
- if [ "$JQUERY" ] && [ "$BROWSERSTACK_USERNAME" ] ; then yarn run test-bs ; fi
after_success:
- if [ -f "./coverage/lcov.info" ] ; then cat ./coverage/lcov.info | ./node_modules/coveralls/bin/coveralls.js ; fi

deploy:
provider: npm
email: bjorn@swis.nl
Expand All @@ -51,4 +46,4 @@ deploy:
tags: true
repo: swisnl/jQuery-contextMenu
branch: master
condition: $JQUERY = 3
condition: "$JQUERY = 3"
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
# jQuery contextMenu plugin & polyfill #

[![Travis](https://img.shields.io/travis/swisnl/jQuery-contextMenu/master.svg?style=flat-square&maxAge=600)](https://travis-ci.org/swisnl/jQuery-contextMenu) [![npm](https://img.shields.io/npm/v/jquery-contextmenu.svg?style=flat-square&maxAge=600)](https://www.npmjs.com/package/jquery-contextmenu) [![npm](https://img.shields.io/npm/dm/jquery-contextmenu.svg?style=flat-square&maxAge=600)](https://www.npmjs.com/package/jquery-contextmenu) [![CDNJS](https://img.shields.io/cdnjs/v/jquery-contextmenu.svg?style=flat-square&maxAge=600)](https://cdnjs.com/libraries/jquery-contextmenu) [![npm](https://img.shields.io/npm/l/jquery-contextmenu.svg?style=flat-square)]() [![Coverage Status](https://img.shields.io/coveralls/github/swisnl/jQuery-contextMenu/api-consolidation.svg)](https://coveralls.io/github/swisnl/jQuery-contextMenu?branch=api-consolidation) [![Greenkeeper badge](https://badges.greenkeeper.io/swisnl/jQuery-contextMenu.svg)](https://greenkeeper.io/)
[![Travis](https://img.shields.io/travis/swisnl/jQuery-contextMenu/master.svg?style=flat-square&maxAge=600)](https://travis-ci.org/swisnl/jQuery-contextMenu) [![npm](https://img.shields.io/npm/v/jquery-contextmenu.svg?style=flat-square&maxAge=600)](https://www.npmjs.com/package/jquery-contextmenu) [![npm](https://img.shields.io/npm/vpre/jquery-contextmenu.svg?style=flat-square&maxAge=600)](https://www.npmjs.com/package/jquery-contextmenu) [![npm](https://img.shields.io/npm/dm/jquery-contextmenu.svg?style=flat-square&maxAge=600)](https://www.npmjs.com/package/jquery-contextmenu) [![CDNJS](https://img.shields.io/cdnjs/v/jquery-contextmenu.svg?style=flat-square&maxAge=600)](https://cdnjs.com/libraries/jquery-contextmenu) [![npm](https://img.shields.io/npm/l/jquery-contextmenu.svg?style=flat-square)]() [![Coverage Status](https://img.shields.io/coveralls/github/swisnl/jQuery-contextMenu/api-consolidation.svg)](https://coveralls.io/github/swisnl/jQuery-contextMenu?branch=api-consolidation) [![Greenkeeper badge](https://badges.greenkeeper.io/swisnl/jQuery-contextMenu.svg)](https://greenkeeper.io/)
[![BrowserStack Status](https://www.browserstack.com/automate/badge.svg?badge_key=M0xTRE4zc3ZiY1Y2TVpubHZWT2NZUEU4TU9aNlY1ME9QS2FKeEdoUFl6ST0tLWtGcUd0U2M2U3hMZEF1OWs3S09GdFE9PQ==--fa7fa1e362e706cc38d21f37a8e28181e0bff94f)](https://www.browserstack.com/automate/public-build/M0xTRE4zc3ZiY1Y2TVpubHZWT2NZUEU4TU9aNlY1ME9QS2FKeEdoUFl6ST0tLWtGcUd0U2M2U3hMZEF1OWs3S09GdFE9PQ==--fa7fa1e362e706cc38d21f37a8e28181e0bff94f)


$.contextMenu is a management facility for - you guessed it - context menus. It was designed for an application where there are hundreds of elements that may show a context menu - so intialization speed and memory usage are kept fairly small. It also allows to register context menus without providing actual markup, as $.contextMenu generates DOMElements as needed.
Expand All @@ -10,7 +11,6 @@ $.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 ##

Expand Down
153 changes: 153 additions & 0 deletions karma-browserstack.conf.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,153 @@
let projectname = 'jquery-contextmenu';
if (process.env.TRAVIS_PULL_REQUEST !== 'false' && process.env.TRAVIS_PULL_REQUEST !== false) {
projectname += '-pr';
} else if (process.env.TRAVIS_BRANCH) {
projectname += '-' + process.env.TRAVIS_BRANCH;
} else {
projectname += '-develop';
}
console.log('Browserstack project name', projectname);

const browserslist = require('browserslist');
const pkg = require('./package');
const browsers = browserslist(pkg.browserslist);
const supportedBrowsers = {
'IE': [],
'Chrome': [],
'Firefox': [],
'Edge': []
};
for (let i in browsers) {
for (let browser in supportedBrowsers) {
if (browsers[i].indexOf(browser.toLowerCase() + ' ') === 0) {
supportedBrowsers[browser].push(browsers[i].split(' ')[1]);
}
}
}
supportedBrowsers['Safari'] = ['latest'];

module.exports = function (config) {
if (!process.env.BROWSERSTACK_USERNAME || !process.env.BROWSERSTACK_ACCESS_KEY) {
console.log('Make sure the BROWSERSTACK_USERNAME and BROWSERSTACK_ACCESS_KEY environment variables are set.')
process.exit(1)
}

let testedCapabilities = {};

let capabilities = {
'Windows': {
'7': [
'IE'
],
'10': [
'Edge',
'Firefox',
'Chrome'
]
},
'OS X': {
'High Sierra': [
'Safari',
'Firefox',
'Chrome'
],
'Sierra': [
'Safari',
'Firefox',
'Chrome'
]
}
};

let buildDate = new Date().toISOString();
for (let os in capabilities) {
if (!capabilities.hasOwnProperty(os)) {
continue;
}
for (let osVersion in capabilities[os]) {
if (!capabilities[os].hasOwnProperty(osVersion)) {
continue;
}
for (let browserIndex in capabilities[os][osVersion]) {
if (!capabilities[os][osVersion].hasOwnProperty(browserIndex)) {
continue;
}
let browserKey = capabilities[os][osVersion][browserIndex];

for (let i = 0; i < supportedBrowsers[browserKey].length; i++) {
let browserVersion = supportedBrowsers[browserKey][i];
let uniqueName = os + ' ' + osVersion + ' ' + browserKey + ' ' + browserVersion;
testedCapabilities[uniqueName] = {
base: 'BrowserStack',
platform: osVersion,
browser: browserKey,
browser_version: browserVersion,
os: os,
os_version: osVersion,
name: uniqueName,
build: buildDate
};
}
}
}
}

config.set({
basePath: '',

// frameworks to use
// available frameworks: https://npmjs.org/browse/keyword/karma-adapter
frameworks: ['qunit', 'sinon'],

// list of files / patterns to load in the browser
files: [
{pattern: 'node_modules/jquery/dist/jquery.js', watched: false, served: true, included: true},
{pattern: 'dist/jquery.ui.position.js', watched: false, served: true, included: true},
{pattern: 'src/js/contextmenu.js', watched: true, served: true, included: true},

// test modules
'test/unit/test-events.js'
],

webpack: require('./webpack.test.config'),

reporters: ['BrowserStack'],

port: 9876,
colors: true,

// global config of your BrowserStack account
browserStack: {
project: projectname,
username: process.env.BROWSERSTACK_USERNAME,
accessKey: process.env.BROWSERSTACK_ACCESS_KEY
},

// preprocess matching files before serving them to the browser
// available preprocessors: https://npmjs.org/browse/keyword/karma-preprocessor
preprocessors: {
'./src/js/contextmenu.js': ['webpack', 'sourcemap'],
'./test/unit/test-events.js': ['webpack', 'sourcemap']
},

// level of logging
// possible values: config.LOG_DISABLE || config.LOG_ERROR || config.LOG_WARN || config.LOG_INFO || config.LOG_DEBUG
logLevel: config.LOG_WARN,

// Increase timeout in case connection in CI is slow
captureTimeout: 60000,
customLaunchers: testedCapabilities,
browsers: Object.keys(testedCapabilities),
singleRun: true,
concurrency: Infinity,

plugins: [
'karma-chrome-launcher',
'karma-qunit',
'karma-webpack',
'karma-sourcemap-loader',
'karma-browserstack-launcher',
'karma-sinon'
]
})
};
6 changes: 5 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
"babel-preset-env": "^1.6.1",
"babel-preset-es2015": "^6.24.1",
"babel-preset-stage-2": "^6.24.1",
"browserslist": "^2.10.0",
"coveralls": "^3.0.0",
"css-loader": "^0.28.7",
"doctoc": "^1.2.0",
Expand All @@ -42,6 +43,7 @@
"jquery": "^3.2.1",
"jsdoc": "^3.5.5",
"karma": "^2.0.0",
"karma-browserstack-launcher": "^1.3.0",
"karma-chrome-launcher": "^2.0.0",
"karma-coverage": "^1.1.1",
"karma-coverage-istanbul-reporter": "^1.3.3",
Expand Down Expand Up @@ -113,6 +115,7 @@
"test": "npm run test-unit",
"test-unit": "karma start",
"test-sauce": "karma start karma-saucelabs.conf.js",
"test-bs": "karma start karma-browserstack.conf.js",
"webpack-build": "webpack",
"webpack-watch": "webpack --watch",
"docs": "jsdoc -c ./docstrap.conf.json -t ./node_modules/ink-docstrap/template -R README.md -r ./src/js",
Expand All @@ -122,5 +125,6 @@
"> 1%",
"last 3 versions",
"ie >= 9"
]
],
"dependencies": {}
}
Loading

0 comments on commit fd3927c

Please sign in to comment.