dalek-browser-firefox
Advanced tools
Comparing version 0.0.1 to 0.0.2
@@ -65,4 +65,4 @@ /* jshint camelcase: false */ | ||
options: { | ||
cyclomatic: 4, | ||
halstead: 20, | ||
cyclomatic: 6, | ||
halstead: 22, | ||
maintainability: 60 | ||
@@ -69,0 +69,0 @@ } |
82
index.js
@@ -62,5 +62,11 @@ /*! | ||
* Because of the availability of the Firefox Marionette testing framework, | ||
* Dalek atm. can only drive the Firefox Aurora Debug builds. | ||
* Dalek atm. can only drive the Firefox Nightly Debug builds. | ||
* Also, some weird change that the Mozillians have done to the testing framework, | ||
* the latest browser version dalek supports atm. is version 24, and to be exactly, | ||
* the version from the 18th of June. | ||
* | ||
* You also have to add the location of the browser executable to you Dalekfile, | ||
* You can get the browser here [http://ftp.mozilla.org/pub/mozilla.org/firefox/nightly/2013/06/2013-06-18-mozilla-central-debug/](http://ftp.mozilla.org/pub/mozilla.org/firefox/nightly/2013/06/2013-06-18-mozilla-central-debug/) | ||
* | ||
* Dalek looks for the browser in the std. installation directory, if you installed the | ||
* browser in a different place, you can add the location of the browser executable to you Dalekfile, | ||
* because Dalek isn't capable of finding the executable yet on its own. | ||
@@ -71,3 +77,3 @@ * | ||
* "firefox": { | ||
* "path": "~/Apps/FirefoxAuroraDebug.app/" | ||
* "path": "~/Apps/FirefoxNightlyDebug.app/Contents/MacOS/firefox-bin" | ||
* } | ||
@@ -79,2 +85,3 @@ * }] | ||
* the issue is most probably related to missing commands. | ||
* Please report any issues you find, Thank you :) | ||
* | ||
@@ -164,5 +171,5 @@ * @module DalekJS | ||
defaultBinaries: { | ||
mac: { | ||
bin: 'Contents/MacOS/firefox-bin' | ||
} | ||
linux: 'firefox', | ||
darwin: process.env.HOME + '/Applications/FirefoxNightlyDebug.app/Contents/MacOS/firefox-bin', | ||
win32: process.env.ProgramFiles + '\\NightlyDebug\\firefox.exe' | ||
}, | ||
@@ -233,3 +240,2 @@ | ||
var deferred = Q.defer(); | ||
// init the webdriver server, marionette bindings & the event glue | ||
@@ -282,6 +288,18 @@ this.events = new Events(); | ||
var deferred = Q.defer(); | ||
var methodName = '_checkBinary' + process.platform; | ||
var defaultBinary = null; | ||
if (process.platform === 'darwin') { | ||
defaultBinary = this.defaultBinaries.darwin; | ||
} | ||
if (defaultBinary === null && process.platform === 'win32') { | ||
defaultBinary = this.defaultBinaries.win32; | ||
} | ||
if (defaultBinary === null) { | ||
defaultBinary = this.defaultBinaries.linux; | ||
} | ||
// check if the user has set a custom binary | ||
if (options.path) { | ||
if (options && options.path) { | ||
this._checkUserSetBinary(options.path, deferred); | ||
@@ -291,11 +309,13 @@ return deferred.promise; | ||
// try to find the firefox binary | ||
// check if it is NOT windows or mac | ||
if(!this[methodName]) { | ||
this._checkLinuxBinary(deferred); | ||
return deferred.promise; | ||
// check if the binary exists | ||
if (fs.existsSync(defaultBinary)) { | ||
this.binary = defaultBinary; | ||
deferred.resolve(defaultBinary); | ||
} else { | ||
// TODO: Use daleks super awesome not yet implemented error handler... | ||
console.log('BINARY NOT FOUND:', defaultBinary); | ||
process.exit(); | ||
deferred.reject(); | ||
} | ||
// must be windows or mac | ||
this[methodName](deferred); | ||
return deferred.promise; | ||
@@ -349,3 +369,3 @@ }, | ||
_browserIsReady: function (data) { | ||
return (String(data).search('== 12') !== -1); | ||
return (String(data).search('about:blank') !== -1); | ||
}, | ||
@@ -449,2 +469,12 @@ | ||
case 'win32': | ||
// check if the binary exists | ||
if (fs.existsSync(userPath)) { | ||
this.binary = userPath; | ||
deferred.resolve(userPath); | ||
} else { | ||
// TODO: Use daleks super awesome not yet implemented error handler... | ||
console.log('BINARY NOT FOUND:', userPath); | ||
process.exit(); | ||
deferred.reject(); | ||
} | ||
break; | ||
@@ -457,10 +487,2 @@ case 'darwin': | ||
// check if we need to add a trailing slash | ||
if (userPath[userPath.length - 1] !== '/') { | ||
userPath += '/'; | ||
} | ||
// add the default binary location | ||
userPath += this.defaultBinaries.mac.bin; | ||
// check if the binary exists | ||
@@ -478,2 +500,12 @@ if (fs.existsSync(userPath)) { | ||
default: | ||
// check if the binary exists | ||
if (fs.existsSync(userPath)) { | ||
this.binary = userPath; | ||
deferred.resolve(userPath); | ||
} else { | ||
// TODO: Use daleks super awesome not yet implemented error handler... | ||
console.log('BINARY NOT FOUND:', userPath); | ||
process.exit(); | ||
deferred.reject(); | ||
} | ||
break; | ||
@@ -480,0 +512,0 @@ } |
@@ -36,4 +36,15 @@ /*! | ||
module.exports = function () { | ||
module.exports = function (Marionette) { | ||
Marionette.addCommand({ | ||
name: 'windowSize', | ||
request: { | ||
to: ':marionetteId', | ||
session: ':sessionId', | ||
type: 'executeScript', | ||
value: ':value', | ||
newSandbox: false | ||
} | ||
}); | ||
}; |
@@ -111,3 +111,17 @@ /*! | ||
method: 'post', | ||
params: {width: 'width', height: 'height'} | ||
params: {width: 'width', height: 'height'}, | ||
onRequest: function (req, res) { | ||
// load the marionette connection id & then request the session id | ||
this.events.emit('marionette:cmd:windowSize', {'sessionId': req.params.sessionId, 'value': 'window.resizeTo("' + req.body.height + '", "' + req.body.width + '")' }); | ||
this.events.on('marionette:cmd:windowSize:response', function () { | ||
var answer = { | ||
sessionId: req.params.sessionId, | ||
status: 0, | ||
value: true | ||
}; | ||
res.status(200); | ||
res.send(JSON.stringify(answer)); | ||
}.bind(this)); | ||
} | ||
}); | ||
@@ -114,0 +128,0 @@ |
{ | ||
"name": "dalek-browser-firefox", | ||
"version": "0.0.1", | ||
"version": "0.0.2", | ||
"description": "Firefox browser binding for DalekJS", | ||
@@ -5,0 +5,0 @@ "homepage": "http://dalekjs.com", |
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
Environment variable access
Supply chain riskPackage accesses environment variables, which may be a sign of credential stuffing or data theft.
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
160709
70
4173
12