repo: janusweb action: commit revision: path_from: revision_from: e3e489a8ebcb875f14af73af2cf9638077deb3c4: path_to: revision_to:
commit e3e489a8ebcb875f14af73af2cf9638077deb3c4 Author: James BaicoianuDate: Mon May 9 14:48:52 2016 -0700 Added Karma/Jasmine test suites diff --git a/tests/janusweb.test.js b/tests/janusweb.test.js new file mode 100644 index 0000000000000000000000000000000000000000..ee84e16b103bde8fe5d66f7ff5dd64a210f7acc9 --- /dev/null +++ b/tests/janusweb.test.js @@ -0,0 +1,36 @@ +describe("initialize engine", function() { + jasmine.DEFAULT_TIMEOUT_INTERVAL = 20000; + var client, canvas; + beforeEach(function(done) { + done(); + }); + it("should initialize JanusWeb client", function(done) { + elation.janusweb.init({homepage: 'http://www.janusvr.com/index.html'}).then(function(newclient) { + client = newclient; + expect(client).toBeDefined(); + done(); + }); + }); + it("added canvas to document", function(done) { + var canvases = document.getElementsByTagName('canvas'); + expect(canvases.length).toEqual(1); + canvas = canvases[0]; + done(); + }); + it("should load a room", function(done) { + var janusweb = client.janusweb; + expect(janusweb).toBeDefined(); + elation.events.add(janusweb, 'room_change', function(ev) { + expect(janusweb.currentroom).toBeDefined(); + done(); + }); + }); + it('takes a screenshot', function(done) { + setTimeout(function() { + expect(canvas).toBeDefined(); + var shot = canvas.toDataURL('image/png'); + console.log(shot); + done(); + }, 5000); + }); +}); diff --git a/tests/karma.conf.js b/tests/karma.conf.js new file mode 100644 index 0000000000000000000000000000000000000000..686941bdc262a79c59304364e3048b25983333f9 --- /dev/null +++ b/tests/karma.conf.js @@ -0,0 +1,70 @@ +// Karma configuration +// Generated on Sun May 08 2016 23:14:26 GMT-0700 (PDT) + +module.exports = function(config) { + config.set({ + + // 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: [ + 'build/*.js', + 'tests/*.test.js' + ], + + + // list of files to exclude + exclude: [ + ], + + + // 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: ['progress'], + + + // 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: true, + + + // start these browsers + // available browser launchers: https://npmjs.org/browse/keyword/karma-launcher + browsers: ['Chrome', 'Firefox'], + + + // Continuous Integration mode + // if true, Karma captures browsers, runs the tests and exits + singleRun: false, + + // Concurrency level + // how many browser should be started simultaneous + concurrency: Infinity + }) +}
-----END OF PAGE-----