Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Add angular e2e test-runner

  • Loading branch information...
commit efe27cb2d3e1e14f21c1001be46e2c8e42261079 1 parent 20dcb8a
@ericclemmons authored
View
82 Gruntfile.coffee
@@ -15,7 +15,6 @@ module.exports = (grunt)->
components: 'client/components/'
dist: 'dist/'
server: 'server/'
- test: 'test/'
files:
all: '**/*'
@@ -38,23 +37,29 @@ module.exports = (grunt)->
regarde:
- client:
- files: '<%= dirs.client + files.all %>'
- tasks: [ 'copy:client', 'parallel:jshint', 'less', 'livereload' ]
+ dist:
+ files: '<%= dirs.dist + files.all %>'
+ tasks: [ 'livereload', 'karma:background:run' ]
+
+ js:
+ files: '<%= dirs.client %>/!(components)/<%= files.js %>'
+ tasks: [ 'parallel:jshint', 'copy:js' ]
+
+ less:
+ files: '<%= dirs.client + files.less %>'
+ tasks: [ 'less' ]
server:
files: '<%= dirs.server + files.all %>'
tasks: [ 'parallel:jshint', 'express-server', 'livereload' ]
- test:
- files: '<%= dirs.test + files.all %>'
- tasks: [ 'parallel:jshint', 'karma:background:run']
-
+ templates:
+ files: '<%= dirs.client + files.html %>'
+ tasks: [ 'copy:templates', 'ngtemplates' ]
jshint:
files: [ '<%= dirs.server + files.js %>'
- '<%= dirs.client %>/!(components)/<%= files.js %>'
- '<%= dirs.test + files.js %>' ]
+ '<%= dirs.client %>/!(components)/<%= files.js %>' ]
options:
es5: true
laxcomma: true
@@ -62,30 +67,22 @@ module.exports = (grunt)->
karma:
options:
- browsers: ['PhantomJS'];
- configFile: '<%= dirs.test %>/karma.conf.js'
+ configFile: 'karma.conf.js'
- all:
+ background:
background: true
- browsers: ['PhantomJS', '<%= dirs.test %>/browsers.sh']
singleRun: false
- background:
+ browsers:
+ browsers: [ 'PhantomJS', 'ChromeCanary' ]
background: true
singleRun: false
- unit:
- singleRun: true
+ unit: {}
less:
- app:
- expand: true
- cwd: '<%= dirs.dist %>/app/'
- dest: '<%= less.app.cwd %>'
- src: '<%= files.less %>'
- ext: '.css'
-
+ '<%= dirs.dist %>/app/css/app.css': '<%= dirs.client %>/app/less/app.less'
copy:
images:
@@ -96,8 +93,8 @@ module.exports = (grunt)->
dest: '<%= dirs.dist %>/img'
,
expand: true
- cwd: '<%= dirs.client %>/app'
- src: '<%= files.img %>'
+ cwd: '<%= dirs.client %>'
+ src: [ '<%= files.img %>', '!**/components/<%= files.img %>' ]
dest: '<%= dirs.dist %>'
]
@@ -109,6 +106,22 @@ module.exports = (grunt)->
dest: '<%= dirs.dist %>'
]
+ js:
+ files: [
+ expand: true
+ cwd: '<%= dirs.client %>'
+ src: [ '<%= files.js %>', '!**/components/<%= files.js %>' ]
+ dest: '<%= dirs.dist %>'
+ ]
+
+ templates:
+ files: [
+ expand: true
+ cwd: '<%= dirs.client %>'
+ src: '<%= files.html %>'
+ dest: '<%= dirs.dist %>'
+ ]
+
ngtemplates:
app:
src: '<%= dirs.dist %>/app/<%= files.html %>'
@@ -169,13 +182,10 @@ module.exports = (grunt)->
# - `grunt build` when deploying
###
- grunt.registerTask('default', [ 'validate', 'prepare' ])
- grunt.registerTask('server', [ 'clean', 'default', 'express' ])
- grunt.registerTask('build', [ 'clean', 'prepare', 'ngtemplates', 'optimize' ])
- grunt.registerTask('validate', [ 'jshint' ])
- grunt.registerTask('prepare', [ 'copy', 'less', 'ngtemplates' ])
- grunt.registerTask('express', [ 'livereload-start', 'express-server', 'regarde' ])
- grunt.registerTask('optimize', [ 'useminPrepare', 'concat', 'uglify', 'mincss', 'usemin' ])
- grunt.registerTask('test', [ 'validate', 'karma:unit' ])
- grunt.registerTask('test:watch',[ 'karma:background', 'regarde' ])
- grunt.registerTask('test:all', [ 'karma:all', 'regarde' ])
+ grunt.registerTask('default', [ 'prepare' ])
+ grunt.registerTask('server', [ 'prepare', 'livereload-start', 'karma:background', 'express-server', 'regarde' ])
+ grunt.registerTask('build', [ 'prepare', 'optimize' ])
+ grunt.registerTask('prepare', [ 'clean', 'jshint', 'copy', 'ngtemplates', 'less' ])
+ grunt.registerTask('optimize', [ 'useminPrepare', 'concat', 'uglify', 'mincss', 'usemin' ])
+ grunt.registerTask('test', [ 'prepare', 'karma:unit' ])
+ grunt.registerTask('test:browsers', [ 'karma:browsers', 'server' ])
View
2  test/browsers.sh → bin/browsers.sh
@@ -1,3 +1,5 @@
+#!/bin/bash
+
# Karma custom browser script for running IE7-10
#
# Requirements:
View
1  bower.json
@@ -4,6 +4,7 @@
"dependencies": {
"angular": "~1.0.6",
"angular-mocks": "~1.0.6",
+ "angular-scenario": "~1.0.6",
"angular-strap": "~0.7.3",
"bootstrap": "~2.3.1",
"modernizr": "~2.6.2",
View
BIN  client/app/img/background.jpg
Deleted file not rendered
View
BIN  client/app/img/overlay-dot.png
Deleted file not rendered
View
4 client/app/templates/home.html
@@ -11,7 +11,7 @@
<hr>
<div class="row-fluid">
- <div class="span6">
+ <div class="npm packages span6">
<h3><a href="https://npmjs.org/">NPM</a> Packages</h3>
<table class="table table-striped table-bordered table-hover table-condensed">
@@ -28,7 +28,7 @@
</table>
</div>
- <div class="span6">
+ <div class="bower packages span6">
<h3><a href="http://bower.io/">Bower</a> Packages</h3>
<table class="table table-striped table-bordered table-hover table-condensed">
View
10 client/app/test/e2e/runner.html
@@ -0,0 +1,10 @@
+<!doctype html>
+<html lang="en">
+ <head>
+ <title>End2end Test Runner</title>
+ <script src="../../../../components/angular-scenario/angular-scenario.js" ng-autotest></script>
+ <script src="scenarios.js"></script>
+ </head>
+ <body>
+ </body>
+</html>
View
17 client/app/test/e2e/scenarios.js
@@ -0,0 +1,17 @@
+describe('App', function() {
+ describe('Home view', function() {
+ beforeEach(function() {
+ browser().navigateTo('../../../');
+ });
+
+ it('should list NPM packages', function() {
+ expect(repeater('.npm.packages tr', 'package row').count()).toEqual(17);
+ expect(repeater('.npm.packages tr a', 'package link').count()).toEqual(17);
+ });
+
+ it('should list Bower packages', function() {
+ expect(repeater('.bower.packages tr', 'package row').count()).toEqual(7);
+ expect(repeater('.bower.packages tr a', 'package link').count()).toEqual(0);
+ });
+ });
+});
View
5 test/app/controllers/homeSpec.js → client/app/test/unit/controllers/homeSpec.js
@@ -21,11 +21,8 @@ describe('homeController', function() {
});
});
- it('should set $scope.client', function() {
+ it('should set $scope.client & $scope.server', function() {
expect($scope.client).toBeDefined();
- });
-
- it('should set $scope.server', function() {
expect($scope.server).toBeDefined();
});
});
View
0  test/app/services/apiSpec.js → client/app/test/unit/services/apiSpec.js
File renamed without changes
View
2  client/index.html
@@ -15,7 +15,7 @@
<link href='http://fonts.googleapis.com/css?family=Wire+One' rel='stylesheet' type='text/css'>
<!-- build:css css/app.min.css -->
- <link rel="stylesheet" href="app/less/app.css">
+ <link rel="stylesheet" href="app/css/app.css">
<!-- endbuild -->
<!--[if lt IE 9]>
View
20 karma.conf.js
@@ -0,0 +1,20 @@
+basePath = '';
+
+files = [
+ JASMINE,
+ JASMINE_ADAPTER,
+ 'client/components/angular/angular.js',
+ 'client/components/angular-mocks/angular-mocks.js',
+ 'client/app/js/**/*.js',
+ 'client/app/test/unit/**/*Spec.js'
+];
+
+reporters = [ 'dots' ]; // 'dots', 'progress', 'junit'
+port = 9876;
+runnerPort = 9100;
+colors = true;
+logLevel = LOG_INFO; // LOG_DISABLE || LOG_ERROR || LOG_WARN || LOG_INFO || LOG_DEBUG
+autoWatch = false; // Watch for file changes
+browsers = [ 'PhantomJS' ]; // Chrome, ChromeCanary, Firefox, Opera, Safari (only Mac), PhantomJS, IE (only Windows)
+captureTimeout = 120 * 1000;
+singleRun = true; // Exit upon completion
View
2  package.json
@@ -22,7 +22,7 @@
"scripts": {
"start": "./node_modules/.bin/grunt build && node server/server",
"install": "bower install",
- "test": "./node_modules/.bin/grunt validate"
+ "test": "./node_modules/.bin/grunt test"
},
"dependencies": {
"express": "3.0.5",
View
69 test/karma.conf.js
@@ -1,69 +0,0 @@
-// Karma configuration
-// Generated on Sun Apr 28 2013 11:33:35 GMT-0500 (CDT)
-
-
-// base path, that will be used to resolve files and exclude
-basePath = '../';
-
-
-// list of files / patterns to load in the browser
-files = [
- JASMINE,
- JASMINE_ADAPTER,
- 'client/components/angular/angular.js',
- 'client/components/angular-mocks/angular-mocks.js',
- 'client/!(components)/**/*.js',
- 'test/**/*Spec.js'
-];
-
-
-// list of files to exclude
-exclude = [
-
-];
-
-
-// test results reporter to use
-// possible values: 'dots', 'progress', 'junit'
-reporters = ['dots'];
-
-
-// web server port
-port = 9876;
-
-
-// cli runner port
-runnerPort = 9100;
-
-
-// enable / disable colors in the output (reporters and logs)
-colors = true;
-
-
-// level of logging
-// possible values: LOG_DISABLE || LOG_ERROR || LOG_WARN || LOG_INFO || LOG_DEBUG
-logLevel = LOG_INFO;
-
-
-// enable / disable watching file and executing tests whenever any file changes
-autoWatch = false;
-
-
-// Start these browsers, currently available:
-// - Chrome
-// - ChromeCanary
-// - Firefox
-// - Opera
-// - Safari (only Mac)
-// - PhantomJS
-// - IE (only Windows)
-browsers = ['PhantomJS'];
-
-
-// If browser does not capture in given timeout [ms], kill it
-captureTimeout = 120 * 1000;
-
-
-// Continuous Integration mode
-// if true, it capture browsers, run tests and exit
-singleRun = true;
Please sign in to comment.
Something went wrong with that request. Please try again.