Skip to content

Instantly share code, notes, and snippets.

@anilreddy
Created November 3, 2016 07:27
Show Gist options
  • Save anilreddy/95fe9dea146381ed1a27c19b03ee6d30 to your computer and use it in GitHub Desktop.
Save anilreddy/95fe9dea146381ed1a27c19b03ee6d30 to your computer and use it in GitHub Desktop.
Grunt.js for protractor tasks
module.exports = function(grunt) {
grunt.initConfig({
//For reading Packages
pkg: grunt.file.readJSON('package.json'),
jshint: {
//For reading and executing the spec files
files: ['Gruntfile.js', 'specs/*.js'],
options: {
// options here to override JSHint defaults
globals: {
jQuery: true,
console: true,
module: true,
document: true
}
}
},
protractor: {
options: {
keepAlive: true,
// Protractor config file
configFile: "protractor.config.js"
},
singlerun: {},
auto: {
keepAlive: true,
options: {
// Selenium specific arguments
args: {
seleniumPort: 4444,
seleniumArgs: ['-browserTimeout=60']
}
}
}
},
shell: {
options: {
stdout: true
},
// Different commands that are frequently used
protractor_install: {
command: 'node ./node_modules/protractor/bin/webdriver-manager update'
},
npm_install: {
command: 'npm install'
},
clean: {
command: 'mvn clean'
},
generate: {
command: 'mvn site -Dallure.results_pattern=allure-results'
},
jetty: {
command: 'mvn jetty:run -Djetty.port=1234'
}
}
});
grunt.loadNpmTasks('grunt-protractor-runner');
grunt.loadNpmTasks('grunt-contrib-jshint');
grunt.loadNpmTasks('grunt-shell-spawn');
grunt.registerTask('install', [ 'shell:npm_install', 'shell:protractor_install' ]);
grunt.registerTask('generate', [ 'shell:clean', 'shell:generate', 'shell:jetty' ]);
grunt.registerTask('default', [ 'install', 'jshint', 'protractor:singlerun', 'generate' ]);
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment