Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Content type checking #19

Merged
merged 3 commits into from
Sep 8, 2014
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
36 changes: 34 additions & 2 deletions Gruntfile.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ module.exports = function(grunt) {
grunt.initConfig({
connect: {
options: {
keepalive: true,
keepalive: false,
port: 8000,
hostname: '0.0.0.0',
base: '.'
Expand Down Expand Up @@ -92,17 +92,49 @@ module.exports = function(grunt) {
},
dest: 'angular-xml.min.js'
}
},
protractor: {
options: {
configFile: 'test/e2e.conf.js',
keepAlive: false,
noColor: false,
args: {
chromeDriver: 'node_modules/grunt-protractor-runner/node_modules/protractor/selenium/chromedriver'
}
},
'stand-alone': {},
watch: {
options: {
keepAlive: true
}
},
attach: {
options: {
args: {
seleniumAddress: 'http://127.0.0.1:4444/wd/hub'
}
}
}
},
watch: {
protractor: {
files: ['angular-xml.js', 'test/e2e/**/*Spec.js', 'test/e2e/**/*Spec.html'],
tasks: ['protractor:watch']
}
}
});

// These plugins provide necessary tasks.
grunt.loadNpmTasks('grunt-contrib-connect');
grunt.loadNpmTasks('grunt-contrib-jshint');
grunt.loadNpmTasks('grunt-contrib-watch');
grunt.loadNpmTasks('grunt-http');
grunt.loadNpmTasks('grunt-protractor-runner');

// Default task.
grunt.registerTask('default', ['jshint', 'http']);
grunt.registerTask('test:e2e', 'Run the end to end tests with Karma and keep a test server running in the background', ['connect:test-server']);
grunt.registerTask('test:e2e', 'Run the end to end tests with Karma and keep a test server running in the background', ['connect:test-server', 'protractor:stand-alone']);
grunt.registerTask('dev', ['connect:test-server', 'watch']);

};

2 changes: 1 addition & 1 deletion angular-xml.js
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@

function xmlHttpInterceptorFactory($q, xmlFilter) {
function responseHandler(response) {
if (response) {
if (response && response.headers('content-type') === 'application/xml') {
response.xml = xmlFilter(response.data);
return response;
} else {
Expand Down
4 changes: 2 additions & 2 deletions bower.json
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
"test"
],
"devDependencies": {
"angular": "~1.2.0-rc.3",
"angular-mocks": "~1.2.0-rc.3"
"angular": "~1.2.22",
"angular-mocks": "~1.2.22"
}
}
27 changes: 13 additions & 14 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,28 +8,27 @@
},
"devDependencies": {
"grunt": "~0.4.1",
"grunt-http": "~0.0.2",
"grunt-contrib-jshint": "~0.6.0",
"karma-ng-scenario": "~0.1.0",
"grunt-contrib-connect": "~0.8.0",
"grunt-contrib-jshint": "~0.10.0",
"grunt-contrib-watch": "^0.6.1",
"grunt-http": "~1.4.1",
"grunt-protractor-runner": "^1.1.4",
"karma": "~0.12.23",
"karma-chrome-launcher": "~0.1.0",
"karma-firefox-launcher": "~0.1.0",
"karma-script-launcher": "~0.1.0",
"karma-html2js-preprocessor": "~0.1.0",
"karma-jasmine": "~0.1.3",
"karma-requirejs": "~0.1.0",
"karma-coffee-preprocessor": "~0.1.0",
"karma-jasmine": "~0.1.5",
"karma-phantomjs-launcher": "~0.1.0",
"karma": "~0.10.4",
"grunt-contrib-connect": "~0.5.0"
"karma-script-launcher": "~0.1.0"
},
"scripts": {
"dev": "grunt dev & node_modules/karma/bin/karma start test/unit.conf",
"test": "npm run jshint && npm run unit && npm run e2e",
"unit": "karma start test/karma-unit.js --no-auto-watch --single-run",
"e2e": "karma start test/karma-e2e.js --no-auto-watch --single-run",
"karma": "karma start test/karma-unit.js & karma start test/karma-e2e.js",
"unit": "node_modules/karma/bin/karma start test/unit.conf.js --no-auto-watch --single-run",
"e2e": "grunt test:e2e",
"jshint": "grunt jshint",
"compile": "grunt http",
"prepublish": "npm test && npm run compile"
"prepublish": "npm test && npm run compile",
"postinstall": "node_modules/grunt-protractor-runner/node_modules/.bin/webdriver-manager update"
},
"repository": {
"type": "git",
Expand Down
27 changes: 27 additions & 0 deletions test/e2e.conf.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
// An example configuration file.
exports.config = {
// Do not start a Selenium Standalone sever - only run this using chrome.
chromeOnly: true,
chromeDriver: '../selenium/chromedriver',

// Capabilities to be passed to the webdriver instance.
capabilities: {
'browserName': 'chrome'
},

// Spec patterns are relative to the current working directly when
// protractor is called.
specs: ['e2e/**/*Spec.js'],

baseUrl: 'http://localhost:8000',

// Options to be passed to Jasmine-node.
jasmineNodeOpts: {
showColors: true,
includeStackTrace: true,
defaultTimeoutInterval: 30000
},

keepAlive: true
};

6 changes: 3 additions & 3 deletions test/e2e/xmlSpec.html
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,8 @@
<ul class="blogs">
<li ng-repeat="blog in blogs">{{blog.id}} - {{blog.name}}</li>
</ul>
<script src="/app/bower_components/angular/angular.js"></script>
<script src="/app/angular-xml.js"></script>
<script src="/bower_components/angular/angular.js"></script>
<script src="/angular-xml.js"></script>
<script>
angular
.module('blogs', ['xml'])
Expand All @@ -32,7 +32,7 @@
$scope.blogs = blogs;
});
});
</script>
</script>
</body>
</html>

4 changes: 2 additions & 2 deletions test/e2e/xmlSpec.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,11 @@
describe('xml', function () {

beforeEach(function () {
browser().navigateTo('/app/test/e2e/xmlSpec.html');
browser.get('/test/e2e/xmlSpec.html');
});

it('will render 2 blogs', function () {
expect(repeater('.blogs li').count()).toBe(2);
expect(element.all(by.repeater('blog in blogs')).count()).toBe(2);
});

});
Expand Down
48 changes: 0 additions & 48 deletions test/karma-e2e.js

This file was deleted.

File renamed without changes.
Loading