Skip to content

Instantly share code, notes, and snippets.

@bobsilverberg
Created November 6, 2012 19:01
Show Gist options
  • Save bobsilverberg/4026751 to your computer and use it in GitHub Desktop.
Save bobsilverberg/4026751 to your computer and use it in GitHub Desktop.
~/Documents/gitRepos/marketplace-tests[sia]$ py.test -k test_that_checks_that_manifest_url_cannot_be_edited_via_basic_info_for_a_free_app
====================================================================== test session starts =======================================================================
platform darwin -- Python 2.6.7 -- pytest-2.2.4
collected 75 items
tests/desktop/developer_hub/test_developer_hub.py F
============================================================================ FAILURES ============================================================================
_______________________________ TestDeveloperHub.test_that_checks_that_manifest_url_cannot_be_edited_via_basic_info_for_a_free_app _______________________________
self = <tests.desktop.developer_hub.test_developer_hub.TestDeveloperHub instance at 0x10e22acf8>
mozwebqa = <pytest_mozwebqa.pytest_mozwebqa.TestSetup instance at 0x10e297c20>
@pytest.mark.nondestructive
def test_that_checks_that_manifest_url_cannot_be_edited_via_basic_info_for_a_free_app(self, mozwebqa):
"""Ensure that the manifest url cannot be edited via the basic info form.
Litmus link: https://litmus.mozilla.org/show_test.cgi?id=50478
"""
with pytest.raises(NoSuchElementException):
dev_home = Home(mozwebqa)
dev_home.go_to_developers_homepage()
dev_home.login(user="default")
> my_apps = dev_home.header.click_my_submissions()
tests/desktop/developer_hub/test_developer_hub.py:233:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <pages.desktop.developer_hub.base.HeaderRegion object at 0x10e29cf10>
def click_my_submissions(self):
element = self.selenium.find_element(*self._my_apps_locator)
self._hover_user_menu()
> element.click()
pages/desktop/developer_hub/base.py:61:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <selenium.webdriver.remote.webelement.WebElement object at 0x10e2aa290>
def click(self):
"""Clicks the element."""
> self._execute(Command.CLICK_ELEMENT)
../../../.virtualenvs/marketplace-tests/lib/python2.6/site-packages/selenium/webdriver/remote/webelement.py:52:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <selenium.webdriver.remote.webelement.WebElement object at 0x10e2aa290>, command = 'clickElement'
params = {'id': u'{12da3b62-4d6d-cc44-8ace-2c5066469044}', 'sessionId': u'4a59272c-583b-724c-b6d2-55ebe74d9cfa'}
def _execute(self, command, params=None):
"""Executes a command against the underlying HTML element.
Args:
command: The name of the command to _execute as a string.
params: A dictionary of named parameters to send with the command.
Returns:
The command's JSON response loaded into a dictionary object.
"""
if not params:
params = {}
params['id'] = self._id
> return self._parent.execute(command, params)
../../../.virtualenvs/marketplace-tests/lib/python2.6/site-packages/selenium/webdriver/remote/webelement.py:205:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <selenium.webdriver.firefox.webdriver.WebDriver object at 0x10e243750>, driver_command = 'clickElement'
params = {'id': u'{12da3b62-4d6d-cc44-8ace-2c5066469044}', 'sessionId': u'4a59272c-583b-724c-b6d2-55ebe74d9cfa'}
def execute(self, driver_command, params=None):
"""
Sends a command to be executed by a command.CommandExecutor.
:Args:
- driver_command: The name of the command to execute as a string.
- params: A dictionary of named parameters to send with the command.
:Returns:
The command's JSON response loaded into a dictionary object.
"""
if not params:
params = {'sessionId': self.session_id}
elif 'sessionId' not in params:
params['sessionId'] = self.session_id
params = self._wrap_value(params)
response = self.command_executor.execute(driver_command, params)
if response:
> self.error_handler.check_response(response)
../../../.virtualenvs/marketplace-tests/lib/python2.6/site-packages/selenium/webdriver/remote/webdriver.py:156:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <selenium.webdriver.remote.errorhandler.ErrorHandler object at 0x10e243790>
response = {u'name': u'clickElement', u'sessionId': u'4a59272c-583b-724c-b6d2-55ebe74d9cfa', u'status': 11, u'value': {u'message'...wbgbc4p9m0000gn/T/tmpAYhP8r/extensions/fxdriver@googlecode.com/components/command_processor.js', u'lineNumber': 399}]}}
def check_response(self, response):
"""
Checks that a JSON response from the WebDriver does not have an error.
:Args:
- response - The JSON response from the WebDriver server as a dictionary
object.
:Raises: If the response contains an error message.
"""
status = response['status']
if status == ErrorCode.SUCCESS:
return
exception_class = ErrorInResponseException
if status == ErrorCode.NO_SUCH_ELEMENT:
exception_class = NoSuchElementException
elif status == ErrorCode.NO_SUCH_FRAME:
exception_class = NoSuchFrameException
elif status == ErrorCode.NO_SUCH_WINDOW:
exception_class = NoSuchWindowException
elif status == ErrorCode.STALE_ELEMENT_REFERENCE:
exception_class = StaleElementReferenceException
elif status == ErrorCode.ELEMENT_NOT_VISIBLE:
exception_class = ElementNotVisibleException
elif status == ErrorCode.INVALID_ELEMENT_STATE:
exception_class = InvalidElementStateException
elif status == ErrorCode.INVALID_SELECTOR \
or status == ErrorCode.INVALID_XPATH_SELECTOR \
or status == ErrorCode.INVALID_XPATH_SELECTOR_RETURN_TYPER:
exception_class = InvalidSelectorException
elif status == ErrorCode.ELEMENT_IS_NOT_SELECTABLE:
exception_class = ElementNotSelectableException
elif status == ErrorCode.INVALID_COOKIE_DOMAIN:
exception_class = WebDriverException
elif status == ErrorCode.UNABLE_TO_SET_COOKIE:
exception_class = WebDriverException
elif status == ErrorCode.TIMEOUT:
exception_class = TimeoutException
elif status == ErrorCode.SCRIPT_TIMEOUT:
exception_class = TimeoutException
elif status == ErrorCode.UNKNOWN_ERROR:
exception_class = WebDriverException
elif status == ErrorCode.NO_ALERT_OPEN:
exception_class = NoAlertPresentException
elif status == ErrorCode.IME_NOT_AVAILABLE:
exception_class = ImeNotAvailableException
elif status == ErrorCode.IME_ENGINE_ACTIVATION_FAILED:
exception_class = ImeActivationFailedException
else:
exception_class = WebDriverException
value = response['value']
if type(value) is str:
if exception_class == ErrorInResponseException:
raise exception_class(response, value)
raise exception_class(value)
message = ''
if 'message' in value:
message = value['message']
screen = None
if 'screen' in value:
screen = value['screen']
stacktrace = None
if 'stackTrace' in value and value['stackTrace']:
zeroeth = ''
try:
zeroeth = value['stackTrace'][0]
except:
pass
if zeroeth.has_key('methodName'):
stacktrace = "Method %s threw an error in %s" % \
(zeroeth['methodName'],
self._value_or_default(zeroeth, 'fileName', '[No file name]'))
if exception_class == ErrorInResponseException:
raise exception_class(response, message)
> raise exception_class(message, screen, stacktrace)
E ElementNotVisibleException: Message: u'Element is not currently visible and so may not be interacted with'
../../../.virtualenvs/marketplace-tests/lib/python2.6/site-packages/selenium/webdriver/remote/errorhandler.py:147: ElementNotVisibleException
------------------------------------------------------------------------ pytest-mozwebqa -------------------------------------------------------------------------
Failing URL: https://marketplace-dev.allizom.org/developers/
========================== 74 tests deselected by '-ktest_that_checks_that_manifest_url_cannot_be_edited_via_basic_info_for_a_free_app' ==========================
============================================================ 1 failed, 74 deselected in 29.68 seconds ============================================================
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment