Skip to content

Commit

Permalink
Fix Protractor tests
Browse files Browse the repository at this point in the history
  • Loading branch information
jpetitcolas committed May 19, 2015
1 parent 9a9d0fe commit 65e23df
Show file tree
Hide file tree
Showing 5 changed files with 33 additions and 41 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ dist
.sass-cache
src/javascripts/bower_components
src/javascripts/config.js
src/javascripts/test/fixtures/examples/blog
src/styles/*.css
build/require
build/es6
Expand Down
67 changes: 28 additions & 39 deletions Gruntfile.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,51 +6,34 @@ module.exports = function (grunt) {
// Define the configuration for all the tasks
grunt.initConfig({
copy: {
css_dev: {
src: 'build/ng-admin.min.css',
dest: 'examples/blog/build/ng-admin.css',
options: {
process: function(content) {
return content.replace(/url\("\.\.\/src\/javascripts\/bower_components\/bootstrap-sass-official\/assets\/fonts\/bootstrap/g, 'url(".');
}
}
test_build: {
src: 'build/*',
dest: 'src/javascripts/test/fixtures/examples/blog/'
},
fonts_dev: {
cwd: 'src/javascripts/bower_components/bootstrap-sass-official/assets/fonts/bootstrap/',
src: ['**'],
dest: 'examples/blog/build/',
expand: true
},
assets_dev: {
cwd: 'assets/',
src: ['**'],
dest: 'examples/blog/assets/',
expand: true
},
js_dev: {
src: 'build/ng-admin.min.js',
dest: 'examples/blog/build/ng-admin.js'
},
css: {
src: 'build/ng-admin.min.css',
dest: 'examples/blog/build/ng-admin.min.css',
test_sample_app: {
src: 'examples/blog/*',
dest: 'src/javascripts/test/fixtures/',
options: {
process: function(content) {
return content.replace(/url\("\.\.\/src\/javascripts\/bower_components\/bootstrap-sass-official\/assets\/fonts\/bootstrap/g, 'url(".');
return content.replace(/http\:\/\/localhost\:8080\//g, '/');
}
}
},
angular: {
src: 'src/javascripts/bower_components/angular/angular.js',
dest: 'examples/blog/build/angular.js'
}
},
connect: {
server: {
dev: {
options: {
port: 8000,
base: 'examples/blog/',
keepalive: true,
keepalive: false,
livereload: false
}
},
test: {
options: {
port: 8000,
base: 'src/javascripts/test/fixtures/examples/blog/',
keepalive: false,
livereload: false
}
}
Expand Down Expand Up @@ -84,21 +67,27 @@ module.exports = function (grunt) {
},
src: ['src/javascripts/ng-admin/es6/tests/**/*.js']
}
},
exec: {
webpack: './node_modules/webpack/bin/webpack.js',
webpack_watch: './node_modules/webpack-dev-server/bin/webpack-dev-server.js --progress --colors'
}
});

grunt.loadNpmTasks('grunt-contrib-connect');
grunt.loadNpmTasks('grunt-contrib-copy');
grunt.loadNpmTasks('grunt-exec');
grunt.loadNpmTasks('grunt-protractor-runner');
grunt.loadNpmTasks('grunt-json-server');
grunt.loadNpmTasks('grunt-karma');
grunt.loadNpmTasks('grunt-mocha-test');

grunt.registerTask('test', ['mochaTest', 'karma', 'build', 'copy_build', 'connect', 'protractor']);
grunt.registerTask('copy_build', ['copy:config', 'copy:angular', 'copy:js_dev', 'copy:css', 'copy:fonts_dev']);
grunt.registerTask('test', ['mochaTest', 'karma', 'test:e2e']);
grunt.registerTask('test:e2e', ['test:e2e:prepare', 'json_server', 'connect:test', 'protractor']);
grunt.registerTask('test:e2e:prepare', ['exec:webpack', 'copy:test_sample_app', 'copy:test_build']);

grunt.registerTask('test:local', ['mochaTest', 'karma', 'copy_build:dev', 'test:local:e2e']);
grunt.registerTask('test:local:e2e', ['json_server', 'connect', 'protractor']);
grunt.registerTask('test:local', ['mochaTest', 'karma', 'test:local:e2e']);
grunt.registerTask('test:local:e2e', ['test:e2e:prepare', 'json_server', 'connect:test', 'protractor']);

grunt.registerTask('default', ['copy:angular', 'json_server', 'connect']);
grunt.registerTask('default', ['json_server', 'connect:dev', 'exec:webpack_watch']);
};
4 changes: 2 additions & 2 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -6,12 +6,12 @@ install:
./node_modules/protractor/bin/webdriver-manager update

run:
@./node_modules/webpack-dev-server/bin/webpack-dev-server.js --progress --colors --host=0.0.0.0 &
@grunt

build:
@NODE_ENV=production ./node_modules/webpack/bin/webpack.js -p --progress
@cp -Rf build/* examples/blog/build/
@echo "Files build/ng-admin.min.css and build/ng-admin.min.js updated (with minification)"

test: build
test:
@grunt test:local
1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,7 @@
"grunt-contrib-requirejs": "^0.4.4",
"grunt-contrib-uglify": "~0.6.0",
"grunt-contrib-watch": "~0.5.2",
"grunt-exec": "^0.4.6",
"grunt-json-server": "git://github.com/fzaninotto/grunt-json-server.git#c834e50e2151a16930f1378324cf96b91438bdae",
"grunt-karma": "^0.8.3",
"grunt-mocha-test": "^0.12.7",
Expand Down
1 change: 1 addition & 0 deletions src/javascripts/vendors.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ global.numeral = require('numeral');
require('angular-ui-router');
require('angular-sanitize');
require('angular-ui-codemirror');
require('nginflection');
require('textangular');

require('../../node_modules/angular-numeraljs/dist/angular-numeraljs');
Expand Down

0 comments on commit 65e23df

Please sign in to comment.