diff options
-rw-r--r-- | .travis.yml | 13 | ||||
-rw-r--r-- | README.md | 1 | ||||
-rw-r--r-- | karma.conf.js | 191 | ||||
-rw-r--r-- | package.json | 50 | ||||
-rw-r--r-- | tests/run_from_console.casper.js | 2 | ||||
-rwxr-xr-x | tests/run_from_console.js | 12 |
6 files changed, 262 insertions, 7 deletions
diff --git a/.travis.yml b/.travis.yml new file mode 100644 index 0000000..6c594a8 --- /dev/null +++ b/.travis.yml @@ -0,0 +1,13 @@ +language: node_js +node_js: +- '0.11' +env: + matrix: + - TEST_BROWSER_NAME=PhantomJS + - TEST_BROWSER_NAME=chrome TEST_BROWSER_OS='Windows 7,Linux' + - TEST_BROWSER_NAME=firefox TEST_BROWSER_OS='Windows 7,Linux' TEST_BROWSER_VERSION='30,26' + - TEST_BROWSER_NAME='internet explorer' TEST_BROWSER_OS='Windows 7' TEST_BROWSER_VERSION=10 + - TEST_BROWSER_NAME='internet explorer' TEST_BROWSER_OS='Windows 8.1' TEST_BROWSER_VERSION=11 + - TEST_BROWSER_NAME=safari TEST_BROWSER_OS='OS X 10.8' TEST_BROWSER_VERSION=6 + - TEST_BROWSER_NAME=safari TEST_BROWSER_OS='OS X 10.9' TEST_BROWSER_VERSION=7 +before_script: npm install -g karma-cli @@ -1,5 +1,6 @@ ## noVNC: HTML5 VNC Client +[![Build Status](https://travis-ci.org/kanaka/noVNC.svg?branch=refactor%2Fcleanup)](https://travis-ci.org/kanaka/noVNC) ### Description diff --git a/karma.conf.js b/karma.conf.js new file mode 100644 index 0000000..fca5970 --- /dev/null +++ b/karma.conf.js @@ -0,0 +1,191 @@ +// Karma configuration + +module.exports = function(config) { + /*var customLaunchers = { + sl_chrome_win7: { + base: 'SauceLabs', + browserName: 'chrome', + platform: 'Windows 7' + }, + + sl_firefox30_linux: { + base: 'SauceLabs', + browserName: 'firefox', + version: '30', + platform: 'Linux' + }, + + sl_firefox26_linux: { + base: 'SauceLabs', + browserName: 'firefox', + version: 26, + platform: 'Linux' + }, + + sl_windows7_ie10: { + base: 'SauceLabs', + browserName: 'internet explorer', + platform: 'Windows 7', + version: '10' + }, + + sl_windows81_ie11: { + base: 'SauceLabs', + browserName: 'internet explorer', + platform: 'Windows 8.1', + version: '11' + }, + + sl_osxmavericks_safari7: { + base: 'SauceLabs', + browserName: 'safari', + platform: 'OS X 10.9', + version: '7' + }, + + sl_osxmtnlion_safari6: { + base: 'SauceLabs', + browserName: 'safari', + platform: 'OS X 10.8', + version: '6' + } + };*/ + + var customLaunchers = {}; + var browsers = []; + var useSauce = false; + + if (process.env.SAUCE_USERNAME && process.env.SAUCE_ACCESS_KEY) { + useSauce = true; + } + + if (useSauce && process.env.TEST_BROWSER_NAME && process.env.TEST_BROWSER_NAME != 'PhantomJS') { + var names = process.env.TEST_BROWSER_NAME.split(','); + var platforms = process.env.TEST_BROWSER_OS.split(','); + var versions = []; + if (process.env.TEST_BROWSER_VERSION) { + versions = process.env.TEST_BROWSER_VERSION.split(','); + } else { + versions = [null]; + } + + for (var i = 0; i < names.length; i++) { + for (var j = 0; j < platforms.length; j++) { + for (var k = 0; k < versions.length; k++) { + var launcher_name = 'sl_' + platforms[j].replace(/[^a-zA-Z0-9]/g, '') + '_' + names[i]; + if (versions[k]) { + launcher_name += '_' + versions[k]; + } + + customLaunchers[launcher_name] = { + base: 'SauceLabs', + browserName: names[i], + platform: platforms[j], + }; + + if (versions[i]) { + customLaunchers[launcher_name].version = versions[k]; + } + } + } + } + + browsers = Object.keys(customLaunchers); + } else { + useSauce = false; + browsers = ['PhantomJS']; + } + + var my_conf = { + + // 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: ['mocha', 'sinon', 'chai', 'sinon-chai'], + + + // list of files / patterns to load in the browser (loaded in order) + files: [ + 'tests/fake.*.js', + 'include/util.js', // load first to avoid issues, since methods are called immediately + //'../include/*.js', + 'include/base64.js', + 'include/keysym.js', + 'include/keysymdef.js', + 'include/keyboard.js', + 'include/input.js', + 'include/websock.js', + 'include/rfb.js', + 'include/jsunzip.js', + 'include/des.js', + 'include/display.js', + 'tests/test.*.js' + ], + + client: { + mocha: { + 'ui': 'bdd' + } + }, + + // list of files to exclude + exclude: [ + '../include/playback.js', + '../include/ui.js' + ], + + customLaunchers: customLaunchers, + + // start these browsers + // available browser launchers: https://npmjs.org/browse/keyword/karma-launcher + browsers: browsers, + + // preprocess matching files before serving them to the browser + // available preprocessors: https://npmjs.org/browse/keyword/karma-preprocessor + preprocessors: { + + }, + + + // test results reporter to use + // possible values: 'dots', 'progress' + // available reporters: https://npmjs.org/browse/keyword/karma-reporter + reporters: ['mocha', 'saucelabs'], + + + // web server port + port: 9876, + + + // enable / disable colors in the output (reporters and logs) + 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, + + + // enable / disable watching file and executing tests whenever any file changes + autoWatch: false, + + // Continuous Integration mode + // if true, Karma captures browsers, runs the tests and exits + singleRun: true, + + // Increase timeout in case connection is slow/we run more browsers than possible + // (we currently get 3 for free, and we try to run 7, so it can take a while) + captureTimeout: 240000 + }; + + if (useSauce) { + my_conf.sauceLabs = { + testName: 'noVNC Tests (all)', + startConnect: true, + }; + } + + config.set(my_conf); +}; diff --git a/package.json b/package.json new file mode 100644 index 0000000..3f1b29b --- /dev/null +++ b/package.json @@ -0,0 +1,50 @@ +{ + "name": "noVNC", + "version": "0.5.0", + "description": "An HTML5 VNC client", + "main": "karma.conf.js", + "directories": { + "doc": "docs", + "test": "tests" + }, + "scripts": { + "test": "karma start karma.conf.js" + }, + "repository": { + "type": "git", + "url": "https://github.com/kanaka/noVNC.git" + }, + "author": "Joel Martin <github@martintribe.org> (https://github.com/kanaka)", + "contributors": [ + "Solly Ross <sross@redhat.com> (https://github.com/directxman12)", + "Peter Åstrand <astrand@cendio.se> (https://github.com/astrand)", + "Samuel Mannehed <samuel@cendio.se> (https://github.com/samhed)" + ], + "license": "MPL 2.0", + "bugs": { + "url": "https://github.com/kanaka/noVNC/issues" + }, + "homepage": "https://github.com/kanaka/noVNC", + "devDependencies": { + "ansi": "^0.3.0", + "casperjs": "^1.1.0-beta3", + "chai": "^1.9.1", + "commander": "^2.2.0", + "karma": "^0.12.16", + "karma-chai": "^0.1.0", + "karma-mocha": "^0.1.4", + "karma-mocha-reporter": "^0.2.5", + "karma-phantomjs-launcher": "^0.1.4", + "karma-sauce-launcher": "^0.2.8", + "karma-sinon": "^1.0.3", + "karma-sinon-chai": "^0.1.6", + "mocha": "^1.20.1", + "open": "0.0.5", + "phantom": "^0.6.3", + "phantomjs": "^1.9.7-9", + "sinon": "^1.10.2", + "sinon-chai": "^2.5.0", + "spooky": "^0.2.4", + "temp": "^0.8.0" + } +} diff --git a/tests/run_from_console.casper.js b/tests/run_from_console.casper.js index 7cb4b7c..57ed2be 100644 --- a/tests/run_from_console.casper.js +++ b/tests/run_from_console.casper.js @@ -2,7 +2,7 @@ var Spooky = require('spooky'); var path = require('path'); var phantom_path = require('phantomjs').path; -var casper_path = path.resolve(__dirname, 'node_modules/casperjs/bin/casperjs'); +var casper_path = path.resolve(__dirname, '../node_modules/casperjs/bin/casperjs'); process.env.PHANTOMJS_EXECUTABLE = phantom_path; var casper_opts = { child: { diff --git a/tests/run_from_console.js b/tests/run_from_console.js index 0d4cc8f..bfdd1b6 100755 --- a/tests/run_from_console.js +++ b/tests/run_from_console.js @@ -67,16 +67,16 @@ if (program.autoInject) { temp.track(); var template = { - header: "<html>\n<head>\n<meta charset='utf-8' />\n<link rel='stylesheet' href='" + path.resolve(__dirname, 'node_modules/mocha/mocha.css') + "'/>\n</head>\n<body><div id='mocha'></div>", + header: "<html>\n<head>\n<meta charset='utf-8' />\n<link rel='stylesheet' href='" + path.resolve(__dirname, '../node_modules/mocha/mocha.css') + "'/>\n</head>\n<body><div id='mocha'></div>", script_tag: function(p) { return "<script src='" + p + "'></script>"; }, footer: "<script>\nmocha.checkLeaks();\nmocha.globals(['navigator', 'create', 'ClientUtils', '__utils__']);\nmocha.run(function () { window.__mocha_done = true; });\n</script>\n</body>\n</html>" }; - template.header += "\n" + template.script_tag(path.resolve(__dirname, 'node_modules/chai/chai.js')); - template.header += "\n" + template.script_tag(path.resolve(__dirname, 'node_modules/mocha/mocha.js')); - template.header += "\n" + template.script_tag(path.resolve(__dirname, 'node_modules/sinon/pkg/sinon.js')); - template.header += "\n" + template.script_tag(path.resolve(__dirname, 'node_modules/sinon-chai/lib/sinon-chai.js')); - template.header += "\n" + template.script_tag(path.resolve(__dirname, 'node_modules/sinon-chai/lib/sinon-chai.js')); + template.header += "\n" + template.script_tag(path.resolve(__dirname, '../node_modules/chai/chai.js')); + template.header += "\n" + template.script_tag(path.resolve(__dirname, '../node_modules/mocha/mocha.js')); + template.header += "\n" + template.script_tag(path.resolve(__dirname, '../node_modules/sinon/pkg/sinon.js')); + template.header += "\n" + template.script_tag(path.resolve(__dirname, '../node_modules/sinon-chai/lib/sinon-chai.js')); + template.header += "\n" + template.script_tag(path.resolve(__dirname, '../node_modules/sinon-chai/lib/sinon-chai.js')); template.header += "\n<script>mocha.setup('bdd');</script>"; |