marionette-client
Advanced tools
Comparing version 1.7.1 to 1.7.3
(function(module, ns) { | ||
var DEFAULT_CODE = 500; | ||
var STATUSES = Object.freeze({ | ||
'no such element': 'NoSuchElement', | ||
'no such frame': 'NoSuchFrame', | ||
'unknown command': 'UnknownCommand', | ||
'stale element reference': 'StaleElementReference', | ||
'element not visible': 'ElementNotVisible', | ||
'invalid element state': 'InvalidElementState', | ||
'unknown error': 'UnknownError', | ||
'element not selectable': 'ElementIsNotSelectable', | ||
'javascript error': 'JavaScriptError', | ||
'invalid xpath selector': 'XPathLookupError', | ||
'timeout': 'Timeout', | ||
'no such window': 'NoSuchWindow', | ||
'invalid cookie domain': 'InvalidCookieDomain', | ||
'unable to set cookie': 'UnableToSetCookie', | ||
'unexpected alert open': 'UnexpectedAlertOpen', | ||
'no such alert': 'NoAlertOpenError', | ||
'script timeout': 'ScriptTimeout', | ||
'invalid element coordinates': 'InvalidElementCoordinates', | ||
'invalid selector': 'InvalidSelector', | ||
'webdriver error': 'GenericError' | ||
}); | ||
var CODES = Object.freeze({ | ||
7: 'NoSuchElement', | ||
8: 'NoSuchFrame', | ||
9: 'UnknownCommand', | ||
10: 'StaleElementReference', | ||
11: 'ElementNotVisible', | ||
12: 'InvalidElementState', | ||
13: 'UnknownError', | ||
15: 'ElementIsNotSelectable', | ||
17: 'JavaScriptError', | ||
19: 'XPathLookupError', | ||
21: 'Timeout', | ||
23: 'NoSuchWindow', | ||
24: 'InvalidCookieDomain', | ||
25: 'UnableToSetCookie', | ||
26: 'UnexpectedAlertOpen', | ||
27: 'NoAlertOpenError', | ||
28: 'ScriptTimeout', | ||
29: 'InvalidElementCoordinates', | ||
30: 'IMENotAvailable', | ||
31: 'IMEEngineActivationFailed', | ||
32: 'InvalidSelector', | ||
500: 'GenericError' | ||
7: STATUSES['no such element'], | ||
8: STATUSES['no such frame'], | ||
9: STATUSES['unknown command'], | ||
10: STATUSES['stale element reference'], | ||
11: STATUSES['element not visible'], | ||
12: STATUSES['invalid element state'], | ||
13: STATUSES['unknown error'], | ||
15: STATUSES['element not selectable'], | ||
17: STATUSES['javascript error'], | ||
19: STATUSES['invalid xpath selector'], | ||
21: STATUSES['timeout'], | ||
23: STATUSES['no such window'], | ||
24: STATUSES['invalid cookie domain'], | ||
25: STATUSES['unable to set cookie'], | ||
26: STATUSES['unexpected alert open'], | ||
27: STATUSES['no such alert'], | ||
28: STATUSES['script timeout'], | ||
29: STATUSES['invalid element coordinates'], | ||
32: STATUSES['invalid selector'], | ||
500: STATUSES['webdriver error'] | ||
}); | ||
var DEFAULT_STATUS = STATUSES['webdriver error']; | ||
/** | ||
@@ -37,6 +59,9 @@ * Returns an error object given | ||
* | ||
* Status strings are from: | ||
* https://w3c.github.io/webdriver/webdriver-spec.html#handling-errors | ||
* | ||
* { | ||
* message: "Something", | ||
* stacktrace: "wentwrong@line", | ||
* status: 17 | ||
* status: "javascript error" | ||
* } | ||
@@ -48,17 +73,15 @@ * | ||
function MarionetteError(client, options) { | ||
// default to unknown error | ||
var code = options.status || DEFAULT_CODE; | ||
var status = DEFAULT_STATUS; | ||
if (options.status in CODES) | ||
status = CODES[options.status]; | ||
else if (options.status in STATUSES) | ||
status = STATUSES[options.status]; | ||
if (!(code in CODES)) | ||
code = DEFAULT_CODE; | ||
this.client = client; | ||
this.type = this.name = CODES[code]; | ||
this.message = ''; | ||
this.type = status; | ||
this.name = this.type; | ||
if (code) { | ||
this.message += '(' + code + ') '; | ||
} | ||
this.message += (options.message || ''); | ||
this.message = this.name; | ||
if (options.message) | ||
this.message += ': ' + options.message; | ||
this.message += '\nRemote Stack:\n'; | ||
@@ -85,2 +108,3 @@ this.message += options.stacktrace || '<none>'; | ||
MarionetteError.STATUSES = STATUSES; | ||
MarionetteError.CODES = CODES; | ||
@@ -87,0 +111,0 @@ module.exports = MarionetteError; |
@@ -101,3 +101,3 @@ (function(module, ns) { | ||
error: cmd( | ||
numberError: cmd( | ||
{ | ||
@@ -107,3 +107,3 @@ from: 'actor', | ||
message: 'you fail', | ||
status: 1, | ||
status: 7, | ||
stacktrace: 'fail@url\nother:300' | ||
@@ -114,2 +114,13 @@ } | ||
stringError: cmd( | ||
{ | ||
from: 'actor', | ||
error: { | ||
message: 'you fail', | ||
status: 'no such element', | ||
stacktrace: 'fail@url\nother:300' | ||
} | ||
} | ||
), | ||
value: cmd( | ||
@@ -116,0 +127,0 @@ { from: 'actor', value: 'zomg' } |
{ | ||
"name": "marionette-client", | ||
"version": "1.7.1", | ||
"version": "1.7.3", | ||
"author": "The Gaia Team <dev-gaia@lists.mozilla.org>", | ||
"description": "Marionette Javascript Client", | ||
"license": "MIT", | ||
"main": "lib/marionette/index", | ||
"description": "Marionette Javascript Client", | ||
"author": "The Gaia Team <dev-gaia@lists.mozilla.org>", | ||
"dependencies": { | ||
@@ -13,7 +15,5 @@ "debug": "~0.6", | ||
}, | ||
"scripts": { | ||
"test": "make ci REPORTER=dot" | ||
}, | ||
"devDependencies": { | ||
"mocha": "~1.10", | ||
"mocha": "2.0.x", | ||
"xpcwindow": "0.4.4", | ||
@@ -23,10 +23,10 @@ "yuidocjs": "~0.3", | ||
"node-static": "~0.6", | ||
"marionette-js-runner": "~0.2.0", | ||
"mozilla-download": "~0.2", | ||
"marionette-js-runner": "0.5.x", | ||
"mozilla-download": "1.0.x", | ||
"chai": "~1.7.2" | ||
}, | ||
"license": "MIT", | ||
"engine": { | ||
"node": ">=0.4" | ||
"scripts": { | ||
"test": "make ci" | ||
} | ||
} |
{ | ||
"name": "Marionette JS Client", | ||
"description": "JavaScript API/Client for Marionette (https://developer.mozilla.org/en-US/docs/Marionette)", | ||
"version": "0.5.0", | ||
"url": "https://github.com/mozilla-b2g/marionette_js_client", | ||
"version": "1.7.1", | ||
"url": "https://github.com/mozilla-b2g/marionette-js-client", | ||
"logo": "none", | ||
@@ -7,0 +7,0 @@ "options": { |
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
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
99047
3191