Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP

Loading…

Travis-CI testing #474

Merged
merged 9 commits into from

2 participants

@bollwyvl

This pull request adds Travis-CI continuous integration.
Here is the current build status: Build Status

Ouch. 10/137 is not so good. The bright side is that it seems to be a few key issues, such as priv.settings.data being undefined occasionally, and that the behavior of the generated _SpecRunner.html is the same as it was before in Chrome, though FF may have picked up a bit of a flutter.

I hope this helps in getting to at least a baseline for doing automated testing, but due to the selection of browsers supported, this won't cover everything. But who knows? Maybe a headless IE7 can be run under Wine or something.

@warpech
Owner

Looking at your branch, seems that it is safe to merge this pull request before I merge #471. Can you confirm?

@warpech
Owner

I examined this pull request and it looks really neat. Just 2 questions:

1) why did you have to add grunt-cli to package.json? Is that something Travis needs and there is no way to use it globally in Travis? This guide says that the correct way is to install it globally. Readme says that local installation is not officially supported. I see that other people had the same problem already.

2) Is JqueryHandsontableRunner.tmpl really required? Can't grunt-contrib-jasmine use SpecRunner.html?

Thanks, it looks really exciting to be one step closer to full test automation :)

@bollwyvl

Looking at your branch, seems that it is safe to merge this pull request before I merge #471. Can you confirm?

Yep, this has nothing to do with #471. Also just rebased onto 0.8.10.

As I started digging into testing the stuff in #471, I thought it would make sense to get some of this going.

grunt-cli

Yup, researched it up, and now have it in the before_script chunk. good call.

JqueryHandsontableRunner.tmpl

Just trying to "do stuff the X way," but I'm not sure whether X is Node, Grunt or Just Some Guy. Storing the list of dependencies, built source and specs in the checked-in SpecRunner.html, and the entirety of jasmine, seems like a lot of duplication of data, but makes sense if the current target is real browsers, and not Phantom. The generated _SpecRunner.html can be left around after running grunt test, and hence could be checked in for meeting the case of testing against real browsers.

On a related note: I'd like to see the ability to test the un-concated src/ as well, as right now chasing down a problem requires digging into the generated jquery-handsontable.js, then string matching to where that appears in src/wherever.js. Some changes would have to happen in intro. I experimented with this, but couldn't get it to work. Thoughts?

@warpech warpech merged commit 9ffda82 into handsontable:master
@warpech
Owner

Thanks, so I merged your pull request. I have the same result as you had: https://travis-ci.org/warpech/jquery-handsontable

I will work on fixing that during the next days.

JqueryHandsontableRunner.tmpl

I am just trying to keep things DRY so I wanted to avoid having duplicate suite definition in the working tree. Can't SpecRunner.html be used by grunt-contrib-jasmine? I will look into that.

I think it is needless to say that running test suites in real browsers is as much important as in Phantom - to ensure cross-browser compatibility.

On a related note: I'd like to see the ability to test the un-concated src/ as well, as right now chasing down a problem requires digging into the generated jquery-handsontable.js, then string matching to where that appears in src/wherever.js. Some changes would have to happen in intro. I experimented with this, but couldn't get it to work. Thoughts?

Have you tried loading the whole list of scripts in the SpecRunner instead of jquery.handsontable.js? If you omit intro and outro, it might just work (I haven't tried that though).

@bollwyvl
@warpech
Owner

Ah right...

Maybe it can, but then it may be executed too late for some incompatible plugins... (the inside is executed on $(document).ready) Beter avoid that.

Maybe temporarily just add the namespace to the SpecRunner:

<script>
var Handsontable = { //class namespace
  extension: {}, //extenstion namespace
  helper: {} //helper namespace
};
</script>

Before any other script.

@bollwyvl
@warpech
Owner

Now Travis CI is almost passing :) See the release notes for 0.8.13 in the changelog.

@warpech
Owner

BTW I managed to get rid of the file JqueryHandsontableRunner.tmpl by specifying CSS dependencies in the Grunfile.js. It wasn't easy to get through all the docs but now it works

@bollwyvl
@bollwyvl bollwyvl deleted the bollwyvl:travis-testing branch
@bollwyvl

Just saw the green light on the home page. Hooray!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
This page is out of date. Refresh to see the latest.
View
5 .gitignore
@@ -1,2 +1,5 @@
node_modules
-.idea
+.idea
+_SpecRunner.html
+.grunt
+
View
9 .travis.yml
@@ -0,0 +1,9 @@
+language: node_js
+
+node_js:
+ - "0.8"
+
+before_script:
+ - "export DISPLAY=:99.0"
+ - "sh -e /etc/init.d/xvfb start"
+ - "npm install -g grunt-cli"
View
149 Gruntfile.js
@@ -21,72 +21,94 @@
module.exports = function (grunt) {
grunt.initConfig({
pkg: grunt.file.readJSON('package.json'),
- concat: {
- dist: {
- src: [
- 'tmp/intro.js',
-
- 'tmp/core.js',
- 'src/tableView.js',
- 'src/helpers.js',
- 'src/fillHandle.js',
- 'src/undoRedo.js',
- 'src/selectionPoint.js',
-
- 'src/renderers/textRenderer.js',
- 'src/renderers/autocompleteRenderer.js',
- 'src/renderers/checkboxRenderer.js',
- 'src/renderers/numericRenderer.js',
-
- 'src/editors/textEditor.js',
- 'src/editors/autocompleteEditor.js',
- 'src/editors/checkboxEditor.js',
- 'src/editors/dateEditor.js',
+ meta: {
+ src: [
+ 'tmp/core.js',
+ 'src/tableView.js',
+ 'src/helpers.js',
+ 'src/fillHandle.js',
+ 'src/undoRedo.js',
+ 'src/selectionPoint.js',
- 'src/cellTypes.js',
+ 'src/renderers/textRenderer.js',
+ 'src/renderers/autocompleteRenderer.js',
+ 'src/renderers/checkboxRenderer.js',
+ 'src/renderers/numericRenderer.js',
- 'src/pluginHooks.js',
- 'src/plugins/autoColumnSize.js',
- 'src/plugins/columnSorting.js',
- 'src/plugins/contextMenu.js',
- 'src/plugins/legacy.js',
- 'src/plugins/manualColumnMove.js',
- 'src/plugins/manualColumnResize.js',
+ 'src/editors/textEditor.js',
+ 'src/editors/autocompleteEditor.js',
+ 'src/editors/checkboxEditor.js',
+ 'src/editors/dateEditor.js',
+
+ 'src/cellTypes.js',
- 'src/3rdparty/jquery.autoresize.js',
- 'src/3rdparty/sheetclip.js',
- 'src/3rdparty/walkontable.js',
- 'src/3rdparty/copypaste.js',
+ 'src/pluginHooks.js',
+ 'src/plugins/autoColumnSize.js',
+ 'src/plugins/columnSorting.js',
+ 'src/plugins/contextMenu.js',
+ 'src/plugins/legacy.js',
+ 'src/plugins/manualColumnMove.js',
+ 'src/plugins/manualColumnResize.js',
- 'src/outro.js'
- ],
- dest: 'jquery.handsontable.js'
+ 'src/3rdparty/jquery.autoresize.js',
+ 'src/3rdparty/sheetclip.js',
+ 'src/3rdparty/walkontable.js',
+ 'src/3rdparty/copypaste.js',
+ ],
+ vendor: [
+ 'lib/bootstrap-typeahead.js',
+ 'lib/numeral.js',
+ 'lib/jQuery-contextMenu/jquery.contextMenu.js'
+ // seems to have no effect when turned off on contextmenu.html
+ //'lib/jQuery-contextMenu/jquery.ui.position.js'
+ ]
+ },
+
+ concat: {
+ dist: {
+ files: {
+ 'jquery.handsontable.js': [
+ 'tmp/intro.js',
+ '<%= meta.src %>',
+ 'src/outro.js'
+ ]
+ }
},
full_js: {
- src: [
- 'jquery.handsontable.js',
- 'lib/bootstrap-typeahead.js',
- 'lib/numeral.js',
- 'lib/jQuery-contextMenu/jquery.contextMenu.js'
- //'lib/jQuery-contextMenu/jquery.ui.position.js' //seems to have no effect when turned off on contextmenu.html
- ],
- dest: 'dist/jquery.handsontable.full.js'
+ files: {
+ 'dist/jquery.handsontable.full.js': [
+ 'jquery.handsontable.js',
+ '<%= meta.vendor %>'
+ ]
+ }
},
full_css: {
- src: [
- 'jquery.handsontable.css',
- 'lib/jQuery-contextMenu/jquery.contextMenu.css'
- ],
- dest: 'dist/jquery.handsontable.full.css'
+ files: {
+ 'dist/jquery.handsontable.full.css': [
+ 'jquery.handsontable.css',
+ 'lib/jQuery-contextMenu/jquery.contextMenu.css'
+ ]
+ }
}
},
+
watch: {
- files: ['src/*', 'src/editors/*', 'src/plugins/*', 'src/renderers/*', 'src/3rdparty/*', 'src/css/*', 'lib/*'],
+ files: [
+ 'src/*',
+ 'src/editors/*',
+ 'src/plugins/*',
+ 'src/renderers/*',
+ 'src/3rdparty/*',
+ 'src/css/*',
+ 'lib/*'
+ ],
tasks: ['replace', 'concat', 'clean']
},
+
clean: {
dist: ['tmp']
},
+
replace: {
dist: {
options: {
@@ -101,14 +123,41 @@ module.exports = function (grunt) {
'jquery.handsontable.css': 'src/css/jquery.handsontable.css'
}
}
+ },
+
+ jasmine: {
+ src: [
+ 'lib/jquery.min.js',
+ // '<%= meta.src %>',
+ 'jquery.handsontable.js',
+ 'lib/bootstrap-typeahead.js',
+ 'lib/numeral.js',
+ 'lib/jQuery-contextMenu/jquery.contextMenu.js',
+ 'test/jasmine/spec/SpecHelper.js'
+ ],
+ options: {
+ specs: [
+ 'test/jasmine/spec/*Spec.js',
+ 'test/jasmine/spec/*/*Spec.js'
+ ],
+ template: 'test/JqueryHandsontableRunner.tmpl',
+ templateOptions: {
+ css: [
+ 'lib/jQuery-contextMenu/jquery.contextMenu.css',
+ 'jquery.handsontable.css',
+ ]
+ }
+ }
}
});
// Default task.
grunt.registerTask('default', ['replace', 'concat', 'clean']);
+ grunt.registerTask('test', ['default', 'jasmine']);
grunt.loadNpmTasks('grunt-replace');
grunt.loadNpmTasks('grunt-contrib-clean');
grunt.loadNpmTasks('grunt-contrib-concat');
grunt.loadNpmTasks('grunt-contrib-watch');
+ grunt.loadNpmTasks('grunt-contrib-jasmine');
};
View
1  README.md
@@ -1,4 +1,5 @@
# Handsontable
+[![Build Status](https://travis-ci.org/bollwyvl/jquery-handsontable.png?branch=travis-testing)](https://travis-ci.org/bollwyvl/jquery-handsontable)
Handsontable is a minimalistic approach to Excel-like table editor in HTML & jQuery. Requires jQuery 1.7+. Runs in IE7, IE8, IE9, Firefox, Chrome, Safari and Opera.
View
8 package.json
@@ -9,9 +9,13 @@
"version": "0.8.10",
"devDependencies": {
"grunt": "~0.4.0",
- "grunt-replace": "~0.3.2",
+ "grunt-replace": "~0.4.0",
"grunt-contrib-clean": "~0.4.0",
"grunt-contrib-concat": "~0.1.0",
- "grunt-contrib-watch": "~0.2.0"
+ "grunt-contrib-watch": "~0.2.0",
+ "grunt-contrib-jasmine": "~0.3.3"
+ },
+ "scripts":{
+ "test": "grunt test -v"
}
}
View
21 test/JqueryHandsontableRunner.tmpl
@@ -0,0 +1,21 @@
+<!doctype html>
+<html>
+<head>
+ <meta charset="utf-8">
+ <title>Jasmine Spec Runner</title>
+<% css.forEach(function(style){ %>
+ <link rel="stylesheet" type="text/css" href="<%= style %>">
+<% }) %>
+
+ <link rel="stylesheet" media="screen" href="./lib/jQuery-contextMenu/jquery.contextMenu.css">
+ <link rel="stylesheet" media="screen" href="./jquery.handsontable.css">
+
+<% with (scripts) { %>
+ <% [].concat(jasmine, vendor, helpers, src, specs, reporters, start).forEach(function(script){ %>
+ <script src="<%= script %>"></script>
+ <% }) %>
+<% }; %>
+</head>
+<body>
+</body>
+</html>
View
4 test/jasmine/SpecRunner.html
@@ -34,8 +34,8 @@
<script type="text/javascript" src="spec/Core_onKeyDownSpec.js"></script>
<script type="text/javascript" src="spec/Core_copySpec.js"></script>
<script type="text/javascript" src="spec/Core_dataSchemaSpec.js"></script>
- <script type="text/javascript" src="spec/Core_alter.js"></script>
- <script type="text/javascript" src="spec/Core_view.js"></script>
+ <script type="text/javascript" src="spec/Core_alterSpec.js"></script>
+ <script type="text/javascript" src="spec/Core_viewSpec.js"></script>
<script type="text/javascript" src="spec/Core_destroyEditorSpec.js"></script>
<script type="text/javascript" src="spec/Core_getCellMetaSpec.js"></script>
<script type="text/javascript" src="spec/RowHeaderSpec.js"></script>
View
0  test/jasmine/spec/Core_alter.js → test/jasmine/spec/Core_alterSpec.js
File renamed without changes
View
0  test/jasmine/spec/Core_view.js → test/jasmine/spec/Core_viewSpec.js
File renamed without changes
Something went wrong with that request. Please try again.