browserstack-automate
Advanced tools
Comparing version 1.0.1 to 1.0.2
@@ -21,3 +21,3 @@ var nightwatchPatch = require('./framework_patches/nightwatchPatch.js').nightwatchPatch; | ||
callback(); | ||
}; | ||
} | ||
}; | ||
@@ -39,6 +39,2 @@ var afterAll = function(callback) { | ||
frameworkPatch.addCapability('browserstack.key', bstackAccessKey); | ||
if(process.env.BSTACK_BROWSER) { | ||
frameworkPatch.addCapability('browserName', process.env.BSTACK_BROWSER); | ||
} | ||
frameworkPatch.addCapability('os', process.env.BSTACK_OS); | ||
@@ -48,14 +44,22 @@ frameworkPatch.addCapability('os_version', process.env.BSTACK_OS_VERSION); | ||
frameworkPatch.addCapability('device', process.env.BSTACK_DEVICE); | ||
frameworkPatch.trackFrameworkVersion(); | ||
frameworkPatch.seleniumHost('hub.browserstack.com', 80); | ||
frameworkPatch.seleniumHost('hub.browserstack.com', 80); | ||
if(process.env.BSTACK_BROWSER) { | ||
frameworkPatch.addCapability('browserName', process.env.BSTACK_BROWSER); | ||
} | ||
if(process.env.BSTACK_BUILD) { | ||
frameworkPatch.addCapability('build', process.env.BSTACK_BUILD); | ||
} | ||
if(process.env.BSTACK_PROJECT) { | ||
frameworkPatch.addCapability('project', process.env.BSTACK_PROJECT); | ||
} | ||
if(process.env.BSTACK_NAME) { | ||
frameworkPatch.addCapability('name', process.env.BSTACK_NAME); | ||
} | ||
if(process.env.BSTACK_LOCAL && process.env.BSTACK_LOCAL.toLowerCase() == 'true') { | ||
@@ -65,2 +69,3 @@ frameworkPatch.addCapability('browserstack.local', true); | ||
} | ||
trackEnvironment(frameworkPatch.addCapability); | ||
@@ -67,0 +72,0 @@ frameworkPatch.patch(beforeAll, afterAll); |
require('browserstack-automate').Nightwatch(); | ||
nightwatch_config = { | ||
src_folders : [ "test" ], | ||
var nightwatch_config = { | ||
src_folders : [ 'test' ], | ||
globals_path: 'globals.js', | ||
selenium : { | ||
"start_process" : false | ||
'start_process' : false | ||
}, | ||
@@ -10,0 +10,0 @@ |
@@ -1,3 +0,1 @@ | ||
var path = require('path'); | ||
exports.nightwatchPatch = function() { | ||
@@ -9,6 +7,10 @@ var patchOptions = { | ||
}; | ||
return { | ||
addCapability: function(key, value) { | ||
patchOptions['desiredCapabilities'][key] = value; | ||
if (value !== undefined) { | ||
patchOptions['desiredCapabilities'][key] = value; | ||
} | ||
}, | ||
seleniumHost: function(host, port) { | ||
@@ -18,12 +20,14 @@ patchOptions['seleniumHost'] = host; | ||
}, | ||
trackFrameworkVersion: function() { | ||
var nightwatchPackage = require(path.join(require.main.filename, '../../package.json')); | ||
var nightwatchPackage = require(patchOptions.desiredCapabilities['browserstack.framework'] + '/package.json'); | ||
this.addCapability('browserstack.framework_version', nightwatchPackage.version); | ||
}, | ||
patch: function(beforeAll, afterAll) { | ||
var nightwatch = require(path.join(require.main.filename, '../../lib/index.js')); | ||
var nightwatch = require(patchOptions.desiredCapabilities['browserstack.framework'] + '/lib/index.js'); | ||
var client = nightwatch.client; | ||
var CliRunner = require(patchOptions.desiredCapabilities['browserstack.framework'] + '/lib/runner/cli/clirunner.js'); | ||
var origStartSelenium = CliRunner.prototype.startSelenium; | ||
var CliRunner = require(path.join(require.main.filename, '../../lib/runner/cli/clirunner.js')); | ||
var origStartSelenium = CliRunner.prototype.startSelenium; | ||
CliRunner.prototype.startSelenium = function(callback) { | ||
@@ -40,2 +44,3 @@ var self = this; | ||
}); | ||
Object.keys(patchOptions).forEach(function(patchKey) { | ||
@@ -46,2 +51,3 @@ if(patchKey != 'desiredCapabilities') { | ||
}); | ||
options.globals = options.globals || {}; | ||
@@ -55,2 +61,3 @@ var origAfter = options.globals.after; | ||
}; | ||
return client(options); | ||
@@ -57,0 +64,0 @@ }; |
{ | ||
"name": "browserstack-automate", | ||
"version": "1.0.1", | ||
"version": "1.0.2", | ||
"description": "Run selenium tests on BrowserStack using our node.js integration.", | ||
@@ -5,0 +5,0 @@ "repository": { |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
Dynamic require
Supply chain riskDynamic require can indicate the package is performing dangerous or unsafe dynamic code execution.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
Dynamic require
Supply chain riskDynamic require can indicate the package is performing dangerous or unsafe dynamic code execution.
Found 1 instance in 1 package
13316
299