Repository: incubator-zeppelin Updated Branches: refs/heads/master cc5b4bcfa -> 7eb97c081
ZEPPELIN-161 : Fixing grunt test All the test in zeppelin web was failed. Contain older version code Here is the fixed. - [x] Fixing Karma config - [x] Handle js file paths in Karma config in atomically - [x] Fixing config properties - [x] Updating test spec for current code base version Author: madhuka <[email protected]> Closes #179 from Madhuka/milestone06-test-new and squashes the following commits: b270395 [madhuka] fixing grunt test Project: http://git-wip-us.apache.org/repos/asf/incubator-zeppelin/repo Commit: http://git-wip-us.apache.org/repos/asf/incubator-zeppelin/commit/7eb97c08 Tree: http://git-wip-us.apache.org/repos/asf/incubator-zeppelin/tree/7eb97c08 Diff: http://git-wip-us.apache.org/repos/asf/incubator-zeppelin/diff/7eb97c08 Branch: refs/heads/master Commit: 7eb97c081569088e4025c170d4be399a14dcf854 Parents: cc5b4bc Author: madhuka <[email protected]> Authored: Tue Aug 4 16:10:36 2015 +0530 Committer: Lee moon soo <[email protected]> Committed: Mon Aug 10 13:15:09 2015 -0700 ---------------------------------------------------------------------- zeppelin-web/Gruntfile.js | 33 ++++++++++++++++ zeppelin-web/bower.json | 3 +- zeppelin-web/test/karma.conf.js | 40 +++++++++++++++++--- zeppelin-web/test/spec/controllers/main.js | 7 ++-- zeppelin-web/test/spec/controllers/nav.js | 22 +++++------ zeppelin-web/test/spec/controllers/notebook.js | 14 +++---- zeppelin-web/test/spec/controllers/paragraph.js | 9 ++--- zeppelin-web/test/spec/directives/ngenter.js | 14 +++++-- 8 files changed, 102 insertions(+), 40 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/incubator-zeppelin/blob/7eb97c08/zeppelin-web/Gruntfile.js ---------------------------------------------------------------------- diff --git a/zeppelin-web/Gruntfile.js b/zeppelin-web/Gruntfile.js index eabe0fb..57c02c2 100644 --- a/zeppelin-web/Gruntfile.js +++ b/zeppelin-web/Gruntfile.js @@ -207,6 +207,22 @@ module.exports = function (grunt) { app: { src: ['<%= yeoman.app %>/index.html'], ignorePath: /\.\.\// + }, + test: { + devDependencies: true, + src: '<%= karma.unit.configFile %>', + ignorePath: /\.\.\//, + fileTypes:{ + js: { + block: /(([\s\t]*)\/{2}\s*?bower:\s*?(\S*))(\n|\r|.)*?(\/{2}\s*endbower)/gi, + detect: { + js: /'(.*\.js)'/gi + }, + replace: { + js: '\'{{filePath}}\',' + } + } + } } }, @@ -407,6 +423,7 @@ module.exports = function (grunt) { grunt.registerTask('test', [ 'clean:server', + 'wiredep', 'concurrent:test', 'autoprefixer', 'connect:test', @@ -414,6 +431,22 @@ module.exports = function (grunt) { ]); grunt.registerTask('build', [ + 'test', + 'clean:dist', + 'wiredep', + 'useminPrepare', + 'concurrent:dist', + 'autoprefixer', + 'concat', + 'ngAnnotate', + 'copy:dist', + 'cssmin', + 'uglify', + 'usemin', + 'htmlmin' + ]); + + grunt.registerTask('buildSkipTests', [ 'clean:dist', 'wiredep', 'useminPrepare', http://git-wip-us.apache.org/repos/asf/incubator-zeppelin/blob/7eb97c08/zeppelin-web/bower.json ---------------------------------------------------------------------- diff --git a/zeppelin-web/bower.json b/zeppelin-web/bower.json index 0de4a1f..036c403 100644 --- a/zeppelin-web/bower.json +++ b/zeppelin-web/bower.json @@ -28,8 +28,7 @@ "angular-filter": "~0.5.4" }, "devDependencies": { - "angular-mocks": "1.3.8", - "angular-scenario": "1.3.8" + "angular-mocks": "1.3.8" }, "appPath": "src", "resolutions": { http://git-wip-us.apache.org/repos/asf/incubator-zeppelin/blob/7eb97c08/zeppelin-web/test/karma.conf.js ---------------------------------------------------------------------- diff --git a/zeppelin-web/test/karma.conf.js b/zeppelin-web/test/karma.conf.js index cae5e15..e23a186 100644 --- a/zeppelin-web/test/karma.conf.js +++ b/zeppelin-web/test/karma.conf.js @@ -18,15 +18,45 @@ module.exports = function(config) { // list of files / patterns to load in the browser files: [ + // bower:js + 'bower_components/jquery/dist/jquery.js', + 'bower_components/es5-shim/es5-shim.js', 'bower_components/angular/angular.js', - 'bower_components/angular-mocks/angular-mocks.js', - 'bower_components/angular-animate/angular-animate.js', + 'bower_components/json3/lib/json3.js', + 'bower_components/bootstrap/dist/js/bootstrap.js', 'bower_components/angular-cookies/angular-cookies.js', - 'bower_components/angular-route/angular-route.js', 'bower_components/angular-sanitize/angular-sanitize.js', + 'bower_components/angular-animate/angular-animate.js', 'bower_components/angular-touch/angular-touch.js', - 'app/scripts/**/*.js', - 'test/mock/**/*.js', + 'bower_components/angular-route/angular-route.js', + 'bower_components/angular-bootstrap/ui-bootstrap-tpls.js', + 'bower_components/angular-websocket/angular-websocket.min.js', + 'bower_components/ace-builds/src-noconflict/ace.js', + 'bower_components/ace-builds/src-noconflict/mode-scala.js', + 'bower_components/ace-builds/src-noconflict/mode-sql.js', + 'bower_components/ace-builds/src-noconflict/mode-markdown.js', + 'bower_components/ace-builds/src-noconflict/keybinding-emacs.js', + 'bower_components/ace-builds/src-noconflict/ext-language_tools.js', + 'bower_components/ace-builds/src-noconflict/theme-github.js', + 'bower_components/angular-ui-ace/ui-ace.js', + 'bower_components/jquery.scrollTo/jquery.scrollTo.js', + 'bower_components/d3/d3.js', + 'bower_components/nvd3/nv.d3.js', + 'bower_components/jquery-ui/jquery-ui.js', + 'bower_components/angular-dragdrop/src/angular-dragdrop.js', + 'bower_components/perfect-scrollbar/src/perfect-scrollbar.js', + 'bower_components/ng-sortable/dist/ng-sortable.js', + 'bower_components/angular-elastic/elastic.js', + 'bower_components/angular-elastic-input/dist/angular-elastic-input.min.js', + 'bower_components/angular-xeditable/dist/js/xeditable.js', + 'bower_components/highlightjs/highlight.pack.js', + 'bower_components/lodash/lodash.js', + 'bower_components/angular-filter/dist/angular-filter.js', + 'bower_components/angular-mocks/angular-mocks.js', + // endbower + 'src/app/app.js', + 'src/app/app.controller.js', + 'src/app/**/*.js', 'test/spec/**/*.js' ], http://git-wip-us.apache.org/repos/asf/incubator-zeppelin/blob/7eb97c08/zeppelin-web/test/spec/controllers/main.js ---------------------------------------------------------------------- diff --git a/zeppelin-web/test/spec/controllers/main.js b/zeppelin-web/test/spec/controllers/main.js index 462806e..3b2e9da 100644 --- a/zeppelin-web/test/spec/controllers/main.js +++ b/zeppelin-web/test/spec/controllers/main.js @@ -3,7 +3,7 @@ describe('Controller: MainCtrl', function () { // load the controller's module - beforeEach(module('zeppelinWeb2App')); + beforeEach(module('zeppelinWebApp')); var MainCtrl, scope; @@ -16,7 +16,8 @@ describe('Controller: MainCtrl', function () { }); })); - it('should attach a list of awesomeThings to the scope', function () { - expect(scope.awesomeThings.length).toBe(3); + it('should attach a asIframe to the scope', function () { + expect(scope.asIframe).toBeDefined(); }); + }); http://git-wip-us.apache.org/repos/asf/incubator-zeppelin/blob/7eb97c08/zeppelin-web/test/spec/controllers/nav.js ---------------------------------------------------------------------- diff --git a/zeppelin-web/test/spec/controllers/nav.js b/zeppelin-web/test/spec/controllers/nav.js index 006d36f..9bbfbe3 100644 --- a/zeppelin-web/test/spec/controllers/nav.js +++ b/zeppelin-web/test/spec/controllers/nav.js @@ -1,22 +1,18 @@ 'use strict'; - -describe('Controller: NavCtrl', function () { - +describe('Controller: NavCtrl', function() { // load the controller's module - beforeEach(module('zeppelinWeb2App')); - - var NavCtrl, - scope; - + beforeEach(module('zeppelinWebApp')); + var NavCtrl, scope; // Initialize the controller and a mock scope - beforeEach(inject(function ($controller, $rootScope) { + beforeEach(inject(function($controller, $rootScope) { scope = $rootScope.$new(); NavCtrl = $controller('NavCtrl', { $scope: scope }); - })); - it('should attach a list of awesomeThings to the scope', function () { - expect(scope.awesomeThings.length).toBe(3); - }); + it('NavCtrl to toBeDefined', function() { + expect(NavCtrl).toBeDefined(); + expect(NavCtrl.loadNotes).toBeDefined(); + }); + })); }); http://git-wip-us.apache.org/repos/asf/incubator-zeppelin/blob/7eb97c08/zeppelin-web/test/spec/controllers/notebook.js ---------------------------------------------------------------------- diff --git a/zeppelin-web/test/spec/controllers/notebook.js b/zeppelin-web/test/spec/controllers/notebook.js index acbc9b6..48e6ba0 100644 --- a/zeppelin-web/test/spec/controllers/notebook.js +++ b/zeppelin-web/test/spec/controllers/notebook.js @@ -1,22 +1,20 @@ 'use strict'; -describe('Controller: NotebookCtrl', function () { +describe('Controller: NotebookCtrl', function() { // load the controller's module - beforeEach(module('zeppelinWeb2App')); + beforeEach(module('zeppelinWebApp')); - var NotebookCtrl, - scope; + var NotebookCtrl, scope; // Initialize the controller and a mock scope - beforeEach(inject(function ($controller, $rootScope) { + beforeEach(inject(function($controller, $rootScope, websocketMsgSrv, baseUrlSrv) { scope = $rootScope.$new(); NotebookCtrl = $controller('NotebookCtrl', { $scope: scope }); })); - it('should attach a list of awesomeThings to the scope', function () { - expect(scope.awesomeThings.length).toBe(3); - }); + //Test Can be writting for to test NotebookCtrl + }); http://git-wip-us.apache.org/repos/asf/incubator-zeppelin/blob/7eb97c08/zeppelin-web/test/spec/controllers/paragraph.js ---------------------------------------------------------------------- diff --git a/zeppelin-web/test/spec/controllers/paragraph.js b/zeppelin-web/test/spec/controllers/paragraph.js index 6a9e6b9..1ea4d26 100644 --- a/zeppelin-web/test/spec/controllers/paragraph.js +++ b/zeppelin-web/test/spec/controllers/paragraph.js @@ -3,10 +3,9 @@ describe('Controller: ParagraphCtrl', function () { // load the controller's module - beforeEach(module('zeppelinWeb2App')); + beforeEach(module('zeppelinWebApp')); - var ParagraphCtrl, - scope; + var ParagraphCtrl, scope; // Initialize the controller and a mock scope beforeEach(inject(function ($controller, $rootScope) { @@ -16,7 +15,5 @@ describe('Controller: ParagraphCtrl', function () { }); })); - it('should attach a list of awesomeThings to the scope', function () { - expect(scope.awesomeThings.length).toBe(3); - }); + //Write test to test ParagraphCtrl }); http://git-wip-us.apache.org/repos/asf/incubator-zeppelin/blob/7eb97c08/zeppelin-web/test/spec/directives/ngenter.js ---------------------------------------------------------------------- diff --git a/zeppelin-web/test/spec/directives/ngenter.js b/zeppelin-web/test/spec/directives/ngenter.js index 2fef48e..dc2136d 100644 --- a/zeppelin-web/test/spec/directives/ngenter.js +++ b/zeppelin-web/test/spec/directives/ngenter.js @@ -3,7 +3,7 @@ describe('Directive: ngEnter', function () { // load the directive's module - beforeEach(module('zeppelinWeb2App')); + beforeEach(module('zeppelinWebApp')); var element, scope; @@ -12,9 +12,17 @@ describe('Directive: ngEnter', function () { scope = $rootScope.$new(); })); - it('should make hidden element visible', inject(function ($compile) { + it('should be define', inject(function ($compile) { element = angular.element('<ng-enter></ng-enter>'); element = $compile(element)(scope); - expect(element.text()).toBe('this is the ngEnter directive'); + expect(element.text()).toBeDefined(); })); + + //Test the rest of function in ngEnter +/* it('should make hidden element visible', inject(function ($compile) { + element = angular.element('<ng-enter></ng-enter>'); + element = $compile(element)(scope); + expect(element.text()).toBe('this is the ngEnter directive'); + }));*/ }); +
