BrowserStack tasks for grunt
Install this grunt plugin next to your project's grunt.js gruntfile with: npm install grunt-browserstack
Then add this line to your project's grunt.js
gruntfile:
grunt.loadNpmTasks('grunt-browserstack');
Exposes 3 tasks:
Lists the available browsers to the console
browserstack_list: {
dev: {
username: 'USERNAME',
password: 'PASSWORD'
}
}
Starts the requested workers with BrowserStack. Optionally starts a BrowserStack tunnel to expose a local server to the workers.
This task does not exit untli the user presses a key at which time the workers are stopped again. Errors may occur when stopping the workers if they have timed out in the intervening period.
browserstack: {
dev: {
credentials: {
username: 'USERNAME',
password: 'PASSWORD'
},
// optional tunnel configuration - if omitted a tunnel is not started
tunnel: {
// your BrowserStack API key
key: 'KEY',
// a list of hostnames and ports to expose
hosts: [{
name: 'HOSTNAME',
port: PORT,
sslFlag: 0
}]
},
// required worker start configuration
start: {
// time to wait for workers to start running
queueTimeout: QUEUE_TIMEOUT,
// default URL for started workers
url: 'URL',
// default timeout for started workers
timeout: TIMEOUT,
// list of browser types to start, as returned from the list function
browsers: [{
os: 'OS',
browser: 'BROWSER',
version: 'VERSION',
// override the default URL
url: 'URL',
// override the default worker timeout
timeout: TIMEOUT
}, {
os: 'OS',
browser: 'BROWSER',
version: 'VERSION',
// override the default URL
url: 'URL',
// override the default worker timeout
timeout: TIMEOUT
}]
}
}
}
Stops all currently running workers for the given account. For the purposes of cleaning up orphaned workers when needed
browserstack_clean: {
dev: {
username: 'USERNAME',
password: 'PASSWORD'
}
}
In lieu of a formal styleguide, take care to maintain the existing coding style. Add unit tests for any new or changed functionality. Lint and test your code using grunt.
Copyright (c) 2012 Peter Halliday
Licensed under the MIT license.