Skip to content

Instantly share code, notes, and snippets.

@squidge
Created April 4, 2014 21:15
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save squidge/9983307 to your computer and use it in GitHub Desktop.
Save squidge/9983307 to your computer and use it in GitHub Desktop.
Grunt-Protractor-task
module.exports = function(grunt) {
grunt.initConfig({
protractor_webdriver: {
local: {
options: {
path: '',
command: 'webdriver-manager start',
},
},
},
protractor: {
e2e: {
options: {
configFile: "protractor.conf.js", // Target-specific config file
keepAlive: false, // If false, the grunt process stops when the test fails.
noColor: false, // If true, protractor will not use colors in its output.
args: {} // Target-specific arguments
}
},
}
});
grunt.loadNpmTasks('grunt-protractor-webdriver');
grunt.loadNpmTasks('grunt-protractor-runner');
grunt.registerTask('test', function(target) {
return grunt.task.run([
/* spin your server app before launching webdriver */
'protractor_webdriver:local',
'protractor:e2e'
]);
});
};
describe('angularjs homepage', function() {
it('should greet the named user', function() {
browser.get('http://www.angularjs.org');
element(by.model('yourName')).sendKeys('John Doe');
var greeting = element(by.binding('yourName'));
expect(greeting.getText()).toEqual('Hello John Doe!');
});
});
exports.config = {
allScriptsTimeout: 11000,
specs: [
'test/e2e/**/*.js'
],
capabilities: {
'browserName': 'chrome'
},
baseUrl: 'http://localhost:9000',
seleniumAddress: 'http://localhost:4444/wd/hub',
framework: 'jasmine',
jasmineNodeOpts: {
defaultTimeoutInterval: 30000
}
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment