mirror of
https://github.com/taobataoma/meanTorrent.git
synced 2026-02-26 16:21:01 +01:00
fixing grunt and gulp e2e tests
This commit is contained in:
@@ -201,7 +201,8 @@ module.exports = function (grunt) {
|
||||
options: {
|
||||
configFile: 'protractor.conf.js',
|
||||
keepAlive: true,
|
||||
noColor: false
|
||||
noColor: false,
|
||||
webdriverManagerUpdate: true
|
||||
},
|
||||
e2e: {
|
||||
options: {
|
||||
@@ -274,9 +275,11 @@ module.exports = function (grunt) {
|
||||
grunt.registerTask('build', ['env:dev', 'lint', 'ngAnnotate', 'uglify', 'cssmin']);
|
||||
|
||||
// Run the project tests
|
||||
grunt.registerTask('test', ['env:test', 'lint', 'mkdir:upload', 'copy:localConfig', 'server', 'mochaTest', 'karma:unit']);
|
||||
grunt.registerTask('test', ['env:test', 'lint', 'mkdir:upload', 'copy:localConfig', 'server', 'mochaTest', 'karma:unit', 'protractor']);
|
||||
grunt.registerTask('test:server', ['env:test', 'lint', 'server', 'mochaTest']);
|
||||
grunt.registerTask('test:client', ['env:test', 'lint', 'server', 'karma:unit']);
|
||||
grunt.registerTask('test:e2e', ['env:test', 'lint', 'server', 'protractor']);
|
||||
|
||||
// Run project coverage
|
||||
grunt.registerTask('coverage', ['env:test', 'lint', 'mocha_istanbul:coverage']);
|
||||
|
||||
|
||||
38
gulpfile.js
38
gulpfile.js
@@ -15,7 +15,10 @@ var _ = require('lodash'),
|
||||
}
|
||||
}),
|
||||
path = require('path'),
|
||||
endOfLine = require('os').EOL;
|
||||
endOfLine = require('os').EOL,
|
||||
protractor = require("gulp-protractor").protractor,
|
||||
webdriver_update = require("gulp-protractor").webdriver_update,
|
||||
webdriver_standalone = require("gulp-protractor").webdriver_standalone;
|
||||
|
||||
// Set NODE_ENV to 'test'
|
||||
gulp.task('env:test', function () {
|
||||
@@ -195,17 +198,28 @@ gulp.task('karma', function (done) {
|
||||
}));
|
||||
});
|
||||
|
||||
// Selenium standalone WebDriver update task
|
||||
gulp.task('webdriver-update', plugins.protractor.webdriver_update);
|
||||
// Downloads the selenium webdriver
|
||||
gulp.task('webdriver_update', webdriver_update);
|
||||
|
||||
// Start the standalone selenium server
|
||||
// NOTE: This is not needed if you reference the
|
||||
// seleniumServerJar in your protractor.conf.js
|
||||
gulp.task('webdriver_standalone', webdriver_standalone);
|
||||
|
||||
// Protractor test runner task
|
||||
gulp.task('protractor', function () {
|
||||
gulp.task('protractor', ['webdriver_update'], function () {
|
||||
gulp.src([])
|
||||
.pipe(plugins.protractor.protractor({
|
||||
.pipe(protractor({
|
||||
configFile: 'protractor.conf.js'
|
||||
}))
|
||||
.on('error', function (e) {
|
||||
throw e;
|
||||
.on('end', function() {
|
||||
console.log('E2E Testing complete');
|
||||
// exit with success.
|
||||
process.exit(0);
|
||||
})
|
||||
.on('error', function(err) {
|
||||
console.log('E2E Tests failed');
|
||||
process.exit(1);
|
||||
});
|
||||
});
|
||||
|
||||
@@ -221,15 +235,19 @@ gulp.task('build', function (done) {
|
||||
|
||||
// Run the project tests
|
||||
gulp.task('test', function (done) {
|
||||
runSequence('env:test', 'karma', 'mocha', done);
|
||||
runSequence('env:test', 'lint', 'mocha', 'karma', 'nodemon', 'protractor', done);
|
||||
});
|
||||
|
||||
gulp.task('test:server', function (done) {
|
||||
runSequence('env:test', 'mocha', done);
|
||||
runSequence('env:test', 'lint', 'mocha', done);
|
||||
});
|
||||
|
||||
gulp.task('test:client', function (done) {
|
||||
runSequence('env:test', 'karma', done);
|
||||
runSequence('env:test', 'lint', 'karma', done);
|
||||
});
|
||||
|
||||
gulp.task('test:e2e', function (done) {
|
||||
runSequence('env:test', 'lint', 'nodemon', 'protractor', done);
|
||||
});
|
||||
|
||||
// Run the project in development mode
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
describe('Articles E2E Tests:', function () {
|
||||
describe('Test articles page', function () {
|
||||
it('Should report missing credentials', function () {
|
||||
browser.get('http://localhost:3000/articles');
|
||||
browser.get('http://localhost:3001/articles');
|
||||
expect(element.all(by.repeater('article in articles')).count()).toEqual(0);
|
||||
});
|
||||
});
|
||||
|
||||
@@ -3,11 +3,12 @@
|
||||
describe('Users E2E Tests:', function () {
|
||||
describe('Signin Validation', function () {
|
||||
it('Should report missing credentials', function () {
|
||||
browser.get('http://localhost:3000/authentication/signin');
|
||||
browser.get('http://localhost:3001/authentication/signin');
|
||||
element(by.css('button[type=submit]')).click();
|
||||
element(by.binding('error')).getText().then(function (errorText) {
|
||||
expect(errorText).toBe('Missing credentials');
|
||||
});
|
||||
// Username Error
|
||||
expect(element.all(by.css('.error-text')).get(0).getText()).toBe('Username is required.');
|
||||
// Password Error
|
||||
expect(element.all(by.css('.error-text')).get(1).getText()).toBe('Password is required.');
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
@@ -65,6 +65,7 @@
|
||||
"validator": "^3.41.2"
|
||||
},
|
||||
"devDependencies": {
|
||||
"coveralls": "^2.11.4",
|
||||
"grunt-concurrent": "^2.0.0",
|
||||
"grunt-contrib-copy": "~0.8.0",
|
||||
"grunt-contrib-csslint": "~0.4.0",
|
||||
@@ -76,12 +77,12 @@
|
||||
"grunt-contrib-watch": "~0.6.1",
|
||||
"grunt-env": "~0.4.4",
|
||||
"grunt-karma": "~0.11.2",
|
||||
"grunt-mocha-test": "~0.12.7",
|
||||
"grunt-mocha-istanbul": "^2.4.0",
|
||||
"grunt-mocha-test": "~0.12.7",
|
||||
"grunt-ng-annotate": "^1.0.1",
|
||||
"grunt-node-inspector": "~0.2.0",
|
||||
"grunt-nodemon": "~0.4.0",
|
||||
"grunt-protractor-runner": "^2.0.0",
|
||||
"grunt-protractor-runner": "^2.1.0",
|
||||
"gulp": "^3.9.0",
|
||||
"gulp-angular-templatecache": "^1.7.0",
|
||||
"gulp-autoprefixer": "^2.3.1",
|
||||
@@ -111,7 +112,6 @@
|
||||
"load-grunt-tasks": "^3.2.0",
|
||||
"run-sequence": "^1.1.1",
|
||||
"should": "^7.0.1",
|
||||
"supertest": "^1.0.1",
|
||||
"coveralls": "^2.11.4"
|
||||
"supertest": "^1.0.1"
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user