pytest-dev / pytest-splinter

pytest splinter and selenium integration for anyone interested in browser interaction in tests
MIT License
254 stars 51 forks source link

pytest-splinter is not taking screenshot of all failures but just some #37

Closed pjotal closed 9 years ago

pjotal commented 9 years ago

we run our test on CI and once in a while i noticed that some of the failures don't have screenshots being generated in case of failures. do you know what may be causing it?

below is an example:

――――――――――――――――――――――――――――――――――――――――――――――――― test_change_cost_of_misc_charge[20] ――――――――――――――――――――――――――――――――――――――――――――――――――
venv/lib/python2.7/site-packages/pytest_bdd/scenario.pyc:415: in _scenario
    def _scenario():
venv/lib/python2.7/site-packages/pytest_bdd/scenario.py:242: in _execute_scenario
    _execute_step_function(request, scenario, step, step_func, example=example)
venv/lib/python2.7/site-packages/pytest_bdd/scenario.py:177: in _execute_step_function
    step_func(**kwargs)
test_scenarios/sell/sales/conftest.py:39: in then_see_line_item_with_description_and_price
    line_item_description = transaction_lines_page.row_item.find_from(line_item).text
test_scenarios/shared_fixtures/pages/selectors/base_selector.py:71: in find_from
    return self.find_all_from(element).first
test_scenarios/shared_fixtures/pages/selectors/ta_selector.py:20: in find_all_from
    xpath_selector = self.xpath_selector(relative_element=element)
test_scenarios/shared_fixtures/pages/selectors/ta_selector.py:47: in xpath_selector
    if relative_element.find_by_xpath(xpath_selector):
venv/lib/python2.7/site-packages/splinter/driver/webdriver/__init__.py:558: in find_by_xpath
    elements = ElementList(self._element.find_elements_by_xpath(selector))
venv/lib/python2.7/site-packages/selenium/webdriver/remote/webelement.py:242: in find_elements_by_xpath
    return self.find_elements(by=By.XPATH, value=xpath)
venv/lib/python2.7/site-packages/selenium/webdriver/remote/webelement.py:416: in find_elements
    {"using": by, "value": value})['value']
venv/lib/python2.7/site-packages/selenium/webdriver/remote/webelement.py:402: in _execute
    return self._parent.execute(command, params)
venv/lib/python2.7/site-packages/pytest_splinter/webdriver_patches.py:42: in execute
    result = self._base_execute(driver_command, params)
venv/lib/python2.7/site-packages/selenium/webdriver/remote/webdriver.py:173: in execute
    response = self.command_executor.execute(driver_command, params)
venv/lib/python2.7/site-packages/selenium/webdriver/remote/remote_connection.py:349: in execute
    return self._request(command_info[0], url, body=data)
venv/lib/python2.7/site-packages/pytest_splinter/webdriver_patches.py:29: in _request
    return old_request(*args, **kwargs)
venv/lib/python2.7/site-packages/selenium/webdriver/remote/remote_connection.py:380: in _request
    resp = self._conn.getresponse()
/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/httplib.py:1045: in getresponse
    response.begin()
/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/httplib.py:409: in begin
    version, status, reason = self._read_status()
/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/httplib.py:365: in _read_status
    line = self.fp.readline(_MAXLINE + 1)
/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/socket.py:476: in readline
    data = self._sock.recv(self._rbufsize)
E   Failed: Timeout >40s
bubenkoff commented 9 years ago

this traceback shows that there's a timeout talking to the browser, so obviously it's not possible to get a screenshot

bubenkoff commented 9 years ago

reason can be is that selenium's extension failed - it happens from time to time for us as well