mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
Bug 1154691: Align Marionette with WebDriver errors
Adds `invalid selector' and `invalid session id' errors to the server, and aligns the exceptions in the Python client with those in the server. Some of the exceptions are not in use yet and consequently do not carry a `code` property. This is fine because it makes us future-proof when the server starts using them. r=dburns
This commit is contained in:
parent
6a44259ba9
commit
425a524144
@ -11,11 +11,11 @@ import time
|
|||||||
import types
|
import types
|
||||||
import weakref
|
import weakref
|
||||||
|
|
||||||
from b2ginstance import B2GInstance
|
|
||||||
from marionette_driver.errors import InvalidResponseException
|
|
||||||
from marionette_driver.marionette import Marionette
|
from marionette_driver.marionette import Marionette
|
||||||
from marionette_test import MarionetteTestCase
|
from marionette_test import MarionetteTestCase
|
||||||
from marionette_transport import MarionetteTransport
|
from marionette_transport import MarionetteTransport
|
||||||
|
|
||||||
|
from b2ginstance import B2GInstance
|
||||||
from runtests import MarionetteTestRunner, cli
|
from runtests import MarionetteTestRunner, cli
|
||||||
|
|
||||||
class B2GUpdateMarionetteClient(MarionetteTransport):
|
class B2GUpdateMarionetteClient(MarionetteTransport):
|
||||||
@ -237,16 +237,10 @@ class B2GUpdateTestCase(MarionetteTestCase):
|
|||||||
|
|
||||||
self.print_status(status, os.path.basename(path))
|
self.print_status(status, os.path.basename(path))
|
||||||
|
|
||||||
try:
|
results = self.marionette.execute_async_script(data,
|
||||||
results = self.marionette.execute_async_script(data,
|
script_args=[self.testvars],
|
||||||
script_args=[self.testvars],
|
special_powers=True)
|
||||||
special_powers=True)
|
self.handle_results(path, stage, results)
|
||||||
self.handle_results(path, stage, results)
|
|
||||||
except InvalidResponseException, e:
|
|
||||||
# If the update test causes a restart, we will get an invalid
|
|
||||||
# response from the socket here.
|
|
||||||
if not will_restart:
|
|
||||||
raise e
|
|
||||||
|
|
||||||
def handle_results(self, path, stage, results):
|
def handle_results(self, path, stage, results):
|
||||||
passed = results['passed']
|
passed = results['passed']
|
||||||
|
@ -16,8 +16,8 @@ import warnings
|
|||||||
|
|
||||||
|
|
||||||
from marionette_driver.errors import (
|
from marionette_driver.errors import (
|
||||||
MarionetteException, InstallGeckoError, TimeoutException, InvalidResponseException,
|
MarionetteException, TimeoutException,
|
||||||
JavascriptException, NoSuchElementException, XPathLookupException, NoSuchWindowException,
|
JavascriptException, NoSuchElementException, NoSuchWindowException,
|
||||||
StaleElementException, ScriptTimeoutException, ElementNotVisibleException,
|
StaleElementException, ScriptTimeoutException, ElementNotVisibleException,
|
||||||
NoSuchFrameException, InvalidElementStateException, NoAlertPresentException,
|
NoSuchFrameException, InvalidElementStateException, NoAlertPresentException,
|
||||||
InvalidCookieDomainException, UnableToSetCookieException, InvalidSelectorException,
|
InvalidCookieDomainException, UnableToSetCookieException, InvalidSelectorException,
|
||||||
|
@ -49,8 +49,16 @@ class MarionetteException(Exception):
|
|||||||
return "".join(traceback.format_exception(self.__class__, msg, tb))
|
return "".join(traceback.format_exception(self.__class__, msg, tb))
|
||||||
|
|
||||||
|
|
||||||
class InstallGeckoError(MarionetteException):
|
class ElementNotSelectableException(MarionetteException):
|
||||||
pass
|
status = "element not selectable"
|
||||||
|
|
||||||
|
|
||||||
|
class InvalidArgumentException(MarionetteException):
|
||||||
|
status = "invalid argument"
|
||||||
|
|
||||||
|
|
||||||
|
class InvalidSessionIdException(MarionetteException):
|
||||||
|
status = "invalid session id"
|
||||||
|
|
||||||
|
|
||||||
class TimeoutException(MarionetteException):
|
class TimeoutException(MarionetteException):
|
||||||
@ -58,11 +66,6 @@ class TimeoutException(MarionetteException):
|
|||||||
status = "timeout"
|
status = "timeout"
|
||||||
|
|
||||||
|
|
||||||
class InvalidResponseException(MarionetteException):
|
|
||||||
code = (53,)
|
|
||||||
status = "invalid response"
|
|
||||||
|
|
||||||
|
|
||||||
class JavascriptException(MarionetteException):
|
class JavascriptException(MarionetteException):
|
||||||
code = (17,)
|
code = (17,)
|
||||||
status = "javascript error"
|
status = "javascript error"
|
||||||
@ -73,11 +76,6 @@ class NoSuchElementException(MarionetteException):
|
|||||||
status = "no such element"
|
status = "no such element"
|
||||||
|
|
||||||
|
|
||||||
class XPathLookupException(MarionetteException):
|
|
||||||
code = (19,)
|
|
||||||
status = "invalid xpath selector"
|
|
||||||
|
|
||||||
|
|
||||||
class NoSuchWindowException(MarionetteException):
|
class NoSuchWindowException(MarionetteException):
|
||||||
code = (23,)
|
code = (23,)
|
||||||
status = "no such window"
|
status = "no such window"
|
||||||
@ -159,11 +157,6 @@ class FrameSendFailureError(MarionetteException):
|
|||||||
status = "frame send failure"
|
status = "frame send failure"
|
||||||
|
|
||||||
|
|
||||||
class UnsupportedOperationException(MarionetteException):
|
|
||||||
code = (405,)
|
|
||||||
status = "unsupported operation"
|
|
||||||
|
|
||||||
|
|
||||||
class SessionNotCreatedException(MarionetteException):
|
class SessionNotCreatedException(MarionetteException):
|
||||||
code = (33, 71)
|
code = (33, 71)
|
||||||
status = "session not created"
|
status = "session not created"
|
||||||
@ -173,31 +166,50 @@ class UnexpectedAlertOpen(MarionetteException):
|
|||||||
code = (26,)
|
code = (26,)
|
||||||
status = "unexpected alert open"
|
status = "unexpected alert open"
|
||||||
|
|
||||||
|
|
||||||
|
class UnknownCommandException(MarionetteException):
|
||||||
|
code = (9,)
|
||||||
|
status = "unknown command"
|
||||||
|
|
||||||
|
|
||||||
|
class UnknownException(MarionetteException):
|
||||||
|
code = (13,)
|
||||||
|
status = "unknown error"
|
||||||
|
|
||||||
|
|
||||||
|
class UnsupportedOperationException(MarionetteException):
|
||||||
|
code = (405,)
|
||||||
|
status = "unsupported operation"
|
||||||
|
|
||||||
|
|
||||||
excs = [
|
excs = [
|
||||||
MarionetteException,
|
|
||||||
TimeoutException,
|
|
||||||
InvalidResponseException,
|
|
||||||
JavascriptException,
|
|
||||||
NoSuchElementException,
|
|
||||||
XPathLookupException,
|
|
||||||
NoSuchWindowException,
|
|
||||||
StaleElementException,
|
|
||||||
ScriptTimeoutException,
|
|
||||||
ElementNotVisibleException,
|
|
||||||
ElementNotAccessibleException,
|
ElementNotAccessibleException,
|
||||||
NoSuchFrameException,
|
ElementNotSelectableException,
|
||||||
InvalidElementStateException,
|
ElementNotVisibleException,
|
||||||
NoAlertPresentException,
|
|
||||||
InvalidCookieDomainException,
|
|
||||||
UnableToSetCookieException,
|
|
||||||
InvalidElementCoordinates,
|
|
||||||
InvalidSelectorException,
|
|
||||||
MoveTargetOutOfBoundsException,
|
|
||||||
FrameSendNotInitializedError,
|
|
||||||
FrameSendFailureError,
|
FrameSendFailureError,
|
||||||
UnsupportedOperationException,
|
FrameSendNotInitializedError,
|
||||||
|
InvalidArgumentException,
|
||||||
|
InvalidCookieDomainException,
|
||||||
|
InvalidElementCoordinates,
|
||||||
|
InvalidElementStateException,
|
||||||
|
InvalidSelectorException,
|
||||||
|
InvalidSessionIdException,
|
||||||
|
JavascriptException,
|
||||||
|
MarionetteException,
|
||||||
|
MoveTargetOutOfBoundsException,
|
||||||
|
NoAlertPresentException,
|
||||||
|
NoSuchElementException,
|
||||||
|
NoSuchFrameException,
|
||||||
|
NoSuchWindowException,
|
||||||
|
ScriptTimeoutException,
|
||||||
SessionNotCreatedException,
|
SessionNotCreatedException,
|
||||||
|
StaleElementException,
|
||||||
|
TimeoutException,
|
||||||
|
UnableToSetCookieException,
|
||||||
UnexpectedAlertOpen,
|
UnexpectedAlertOpen,
|
||||||
|
UnknownCommandException,
|
||||||
|
UnknownException,
|
||||||
|
UnsupportedOperationException,
|
||||||
]
|
]
|
||||||
|
|
||||||
|
|
||||||
|
@ -14,6 +14,7 @@ const errors = [
|
|||||||
"IllegalArgumentError",
|
"IllegalArgumentError",
|
||||||
"InvalidElementStateError",
|
"InvalidElementStateError",
|
||||||
"InvalidSelectorError",
|
"InvalidSelectorError",
|
||||||
|
"InvalidSessionIdError",
|
||||||
"JavaScriptError",
|
"JavaScriptError",
|
||||||
"NoAlertOpenError",
|
"NoAlertOpenError",
|
||||||
"NoSuchElementError",
|
"NoSuchElementError",
|
||||||
@ -211,6 +212,14 @@ this.InvalidSelectorError = function(msg) {
|
|||||||
};
|
};
|
||||||
InvalidSelectorError.prototype = Object.create(WebDriverError.prototype);
|
InvalidSelectorError.prototype = Object.create(WebDriverError.prototype);
|
||||||
|
|
||||||
|
this.InvalidSessionIdError = function(msg) {
|
||||||
|
WebDriverError.call(this, msg);
|
||||||
|
this.name = "InvalidSessionIdError";
|
||||||
|
this.status = "invalid session id";
|
||||||
|
this.code = 13;
|
||||||
|
};
|
||||||
|
InvalidSessionIdError.prototype = Object.create(WebDriverError.prototype);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Creates an error message for a JavaScript error thrown during
|
* Creates an error message for a JavaScript error thrown during
|
||||||
* executeScript or executeAsyncScript.
|
* executeScript or executeAsyncScript.
|
||||||
|
Loading…
Reference in New Issue
Block a user