restore editor browser tests

pull/12704/head
Carlos Matallín 7 years ago
parent f6eea1d1f2
commit 5baa6361e0

@ -107,7 +107,17 @@ grunt editor_specs
After the building process finish, a webpage will show up with a link to the Jasmine page with all the specs. The URL of this page is `http://localhost:8089/_SpecRunner.html`
Editor specs process won't watch for changes, so every time you modify any file you'll have to run again the Editor specs command.
Then, the process will watch changes in the codebase and will regenerate the specs as needed. Just refresh the Jasmine page to pass again the tests.
**Run specs and regular codebase simultaneously**
If you want to run simultaneously the application and the specs generation follow these steps:
1. Open a terminal with Node v6.9.2 (use nvm) and run `grunt dev`. This will build the application assets and will watch for changes.
2. Open a second terminal and run `grunt affected_editor_specs`.
3. That's it. When you change any Builder Javascript file `grunt dev` will build the application bundle and `grunt affected_editor_specs` will build the specs.
#### Builder specs

@ -319,6 +319,7 @@ module.exports = function (grunt) {
grunt.registerTask('js_editor', [
'cdb',
'copy:js_cartodb',
'setConfig:env.browserify_watch:true',
'run_browserify',
'concat:js',
'jst'
@ -440,13 +441,6 @@ module.exports = function (grunt) {
'watch:js_affected'
]);
grunt.registerTask('build-jasmine-specrunners', _.chain(jasmineCfg)
.keys()
.map(function (name) {
return ['jasmine', name, 'build'].join(':');
})
.value());
grunt.registerTask('setConfig', 'Set a config property', function (name, val) {
grunt.config.set(name, val);
});
@ -457,7 +451,17 @@ module.exports = function (grunt) {
grunt.registerTask('editor_specs', [
'js_editor',
'jasmine:cartodbui:build',
'connect:server'
'connect:server',
'watch:js_affected_editor'
]);
/**
* `grunt affected_editor_specs` compile all Editor specs and launch a webpage in the browser.
*/
grunt.registerTask('affected_editor_specs', 'Build Editor specs', [
'jasmine:cartodbui_affected:build',
'connect:server',
'watch:js_affected_editor'
]);
/**

@ -14,6 +14,7 @@ module.exports = {
// enables watchify when grunt is run with a watch task
// must be evaluated lazily (using template var) to allow override by setConfig task.
// watch: '<%= env.browserify_watch %>',
watch: '<%= env.browserify_watch %>',
browserifyOptions: {

@ -21,6 +21,29 @@ module.exports = {
}
},
cartodbui_affected: {
src: js_files.all.concat([
'lib/build/user_data.js',
'<%= assets_dir %>/javascripts/templates_mustache.js',
'<%= assets_dir %>/javascripts/templates.js',
'lib/build/test_init.js']),
options: {
browser: 'phantomjs',
headless: true,
timeout: 20000,
keepRunner: true,
outfile: '_SpecRunner-affected.html',
host: 'http://localhost:8088',
summary: true,
display: 'short',
helpers: ['http://maps.googleapis.com/maps/api/js?sensor=false&v=3.12'].concat(js_files._spec_helpers),
reportSlowerThan: 2000,
specs: [
'.grunt/browserify_modules_tests.js'
]
}
},
affected: {
options: {
browser: 'phantomjs',

@ -79,6 +79,20 @@ exports.task = function () {
spawn: false,
atBegin: false
}
},
js_affected_editor: {
files: [
'lib/assets/test/spec/cartodb/**/*'
],
tasks: [
'concat:js',
'jst',
'jasmine:cartodbui_affected:build'
],
options: {
spawn: false,
atBegin: false
}
}
};
};

Loading…
Cancel
Save