Selenium tests fail
myszon opened this issue · comments
Selenium tests currently do not work.
Run with the command runtests27-sqlite3 admin_widgets --selenium chrome
or directly from the django test directory with ./runtests.py admin_widgets --selenium chrome
they fail with one of these errors:
======================================================================
ERROR: test_many_to_many (admin_widgets.tests.AdminRawIdWidgetSeleniumTests)
----------------------------------------------------------------------
Traceback (most recent call last):
File "/usr/lib/python3.5/unittest/suite.py", line 163, in _handleClassSetUp
setUpClass()
File "/django/django/test/selenium.py", line 64, in setUpClass
cls.selenium = cls.create_webdriver()
File "/django/django/test/selenium.py", line 55, in create_webdriver
return self.import_webdriver(self.browser)()
File "/home/vagrant/venv/lib/python3.5/site-packages/selenium/webdriver/chrome/webdriver.py", line 69, in __init__
desired_capabilities=desired_capabilities)
File "/home/vagrant/venv/lib/python3.5/site-packages/selenium/webdriver/remote/webdriver.py", line 92, in __init__
self.start_session(desired_capabilities, browser_profile)
File "/home/vagrant/venv/lib/python3.5/site-packages/selenium/webdriver/remote/webdriver.py", line 179, in start_session
response = self.execute(Command.NEW_SESSION, capabilities)
File "/home/vagrant/venv/lib/python3.5/site-packages/selenium/webdriver/remote/webdriver.py", line 236, in execute
self.error_handler.check_response(response)
File "/home/vagrant/venv/lib/python3.5/site-packages/selenium/webdriver/remote/errorhandler.py", line 192, in check_response
raise exception_class(message, screen, stacktrace)
selenium.common.exceptions.WebDriverException: Message: session not created exception
from unknown error: Runtime.executionContextCreated has invalid 'context': {"auxData":{"frameId":"7814.1","isDefault":true},"id":1,"name":"","origin":"://"}
(Session info: chrome=54.0.2840.90)
(Driver info: chromedriver=2.22.397932 (282ed7cf89cf0053b6542e0d0f039d4123bbb6ad),platform=Linux 4.4.0-38-generic x86_64)
or
======================================================================
ERROR: test_date_time_picker_shortcuts (admin_widgets.tests.DateTimePickerAltTimezoneSeleniumTests)
----------------------------------------------------------------------
Traceback (most recent call last):
File "/usr/lib/python3.5/unittest/suite.py", line 163, in _handleClassSetUp
setUpClass()
File "/django/django/test/selenium.py", line 64, in setUpClass
cls.selenium = cls.create_webdriver()
File "/django/django/test/selenium.py", line 55, in create_webdriver
return self.import_webdriver(self.browser)()
File "/home/vagrant/venv/lib/python3.5/site-packages/selenium/webdriver/chrome/webdriver.py", line 69, in __init__
desired_capabilities=desired_capabilities)
File "/home/vagrant/venv/lib/python3.5/site-packages/selenium/webdriver/remote/webdriver.py", line 92, in __init__
self.start_session(desired_capabilities, browser_profile)
File "/home/vagrant/venv/lib/python3.5/site-packages/selenium/webdriver/remote/webdriver.py", line 179, in start_session
response = self.execute(Command.NEW_SESSION, capabilities)
File "/home/vagrant/venv/lib/python3.5/site-packages/selenium/webdriver/remote/webdriver.py", line 234, in execute
response = self.command_executor.execute(driver_command, params)
File "/home/vagrant/venv/lib/python3.5/site-packages/selenium/webdriver/remote/remote_connection.py", line 407, in execute
return self._request(command_info[0], url, body=data)
File "/home/vagrant/venv/lib/python3.5/site-packages/selenium/webdriver/remote/remote_connection.py", line 439, in _request
resp = self._conn.getresponse()
File "/usr/lib/python3.5/http/client.py", line 1197, in getresponse
response.begin()
File "/usr/lib/python3.5/http/client.py", line 297, in begin
version, status, reason = self._read_status()
File "/usr/lib/python3.5/http/client.py", line 266, in _read_status
raise RemoteDisconnected("Remote end closed connection without"
http.client.RemoteDisconnected: Remote end closed connection without response
or
======================================================================
ERROR: test_refresh_page (admin_widgets.tests.HorizontalVerticalFilterSeleniumTests)
----------------------------------------------------------------------
Traceback (most recent call last):
File "/usr/lib/python2.7/unittest/suite.py", line 146, in _handleClassSetUp
setUpClass()
File "/django/django/test/selenium.py", line 64, in setUpClass
cls.selenium = cls.create_webdriver()
File "/django/django/test/selenium.py", line 55, in create_webdriver
return self.import_webdriver(self.browser)()
File "/django/.tox/py27/local/lib/python2.7/site-packages/selenium/webdriver/chrome/webdriver.py", line 69, in __init__
desired_capabilities=desired_capabilities)
File "/django/.tox/py27/local/lib/python2.7/site-packages/selenium/webdriver/remote/webdriver.py", line 92, in __init__
self.start_session(desired_capabilities, browser_profile)
File "/django/.tox/py27/local/lib/python2.7/site-packages/selenium/webdriver/remote/webdriver.py", line 179, in start_session
response = self.execute(Command.NEW_SESSION, capabilities)
File "/django/.tox/py27/local/lib/python2.7/site-packages/selenium/webdriver/remote/webdriver.py", line 234, in execute
response = self.command_executor.execute(driver_command, params)
File "/django/.tox/py27/local/lib/python2.7/site-packages/selenium/webdriver/remote/remote_connection.py", line 407, in execute
return self._request(command_info[0], url, body=data)
File "/django/.tox/py27/local/lib/python2.7/site-packages/selenium/webdriver/remote/remote_connection.py", line 439, in _request
resp = self._conn.getresponse()
File "/usr/lib/python2.7/httplib.py", line 1136, in getresponse
response.begin()
File "/usr/lib/python2.7/httplib.py", line 453, in begin
version, status, reason = self._read_status()
File "/usr/lib/python2.7/httplib.py", line 417, in _read_status
raise BadStatusLine(line)
BadStatusLine: ''
I will continue investigating this problem.
The tests are often flaky so the box might not be at fault, though I see chromedriver should be updated to the latest version (2.24).
They seem to work on the host, just not on the box. It seems as if the browser is not starting correctly. You may be right, it might be caused by an outdated version of chromedriver.
The issue is with the version of chromedriver, the newest one fixes this. I will try to make a patch which makes sure that the newest version of chromedriver is downloaded when the box is built.