Skip to content

Commit

Permalink
Add --local option to use tunnel to local machine
Browse files Browse the repository at this point in the history
  • Loading branch information
andrewn committed Jun 1, 2016
1 parent cd0d4f7 commit 16b867e
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 3 deletions.
9 changes: 7 additions & 2 deletions bin/browsershot
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ function createClient(args) {
return api({
username: args.username,
key : args.key
});
}, args);
}

function listBrowsers(args) {
Expand All @@ -80,7 +80,7 @@ function getBackend(backend) {
var args = require('yargs')
.usage('$0 [general options] <cmd> [command options]')
.config('config') // --config loads JSON
.global(['config', 'output-dir', 'username', 'key', 'backend']) // expose these args to subcommands
.global(['config', 'output-dir', 'username', 'key', 'backend', 'local']) // expose these args to subcommands
.completion()
.option('backend', {
alias: 'b',
Expand All @@ -96,6 +96,11 @@ var args = require('yargs')
alias: 'k',
describe: 'API key',
})
.option('local', {
alias: 'l',
describe: 'enable local URL testing',
default: false
})
.option('output-dir', {
alias: 'o',
describe: 'directory to save screenshots',
Expand Down
8 changes: 7 additions & 1 deletion lib/browserstack-automate.js
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,9 @@ function urlToFilename(url) {
.replace('/', '_');
}

module.exports = function (credentials) {
module.exports = function (credentials, options) {

options = options || {};

var browser = {
'browserName': 'Firefox',
Expand All @@ -97,6 +99,10 @@ module.exports = function (credentials) {
'browserstack.key' : credentials.key,
};

if (options.local === true) {
api['browserstack.local'] = 'true';
}

var capabilities = lodash.assign({}, browser, api);

function createDriver() {
Expand Down

0 comments on commit 16b867e

Please sign in to comment.