summaryrefslogtreecommitdiff
path: root/django/contrib/admin/tests.py
diff options
context:
space:
mode:
authorAkshesh <aksheshdoshi@gmail.com>2016-02-07 07:54:36 +0530
committerSimon Charette <charette.s@gmail.com>2016-03-15 13:10:32 -0400
commit44c0ecdd9226d039a8c666b36ae320af2046a1c1 (patch)
tree0bb97b72359a18c7f1ef39ebd9239ef5ee62dc5f /django/contrib/admin/tests.py
parent93a135d111c2569d88d65a3f4ad9e6d9ad291452 (diff)
Fixed #25364 -- Added generic way to test on all browsers supported by selenium.
Browser names should be passed as a comma separated list to the --selenium flag. Thanks Tim Graham, Simon Charette and Moritz Sichert for review and discussion.
Diffstat (limited to 'django/contrib/admin/tests.py')
-rw-r--r--django/contrib/admin/tests.py30
1 files changed, 3 insertions, 27 deletions
diff --git a/django/contrib/admin/tests.py b/django/contrib/admin/tests.py
index 25610eb173..20292c5dc3 100644
--- a/django/contrib/admin/tests.py
+++ b/django/contrib/admin/tests.py
@@ -1,9 +1,6 @@
-import os
-from unittest import SkipTest
-
from django.contrib.staticfiles.testing import StaticLiveServerTestCase
-from django.test import modify_settings, tag
-from django.utils.module_loading import import_string
+from django.test import modify_settings
+from django.test.selenium import SeleniumTestCase
from django.utils.translation import ugettext as _
@@ -14,11 +11,10 @@ class CSPMiddleware(object):
return response
-@tag('selenium')
@modify_settings(
MIDDLEWARE_CLASSES={'append': 'django.contrib.admin.tests.CSPMiddleware'},
)
-class AdminSeleniumWebDriverTestCase(StaticLiveServerTestCase):
+class AdminSeleniumTestCase(SeleniumTestCase, StaticLiveServerTestCase):
available_apps = [
'django.contrib.admin',
@@ -27,26 +23,6 @@ class AdminSeleniumWebDriverTestCase(StaticLiveServerTestCase):
'django.contrib.sessions',
'django.contrib.sites',
]
- webdriver_class = 'selenium.webdriver.firefox.webdriver.WebDriver'
-
- @classmethod
- def setUpClass(cls):
- if not os.environ.get('DJANGO_SELENIUM_TESTS', False):
- raise SkipTest('Selenium tests not requested')
- try:
- cls.selenium = import_string(cls.webdriver_class)()
- except Exception as e:
- raise SkipTest('Selenium webdriver "%s" not installed or not '
- 'operational: %s' % (cls.webdriver_class, str(e)))
- cls.selenium.implicitly_wait(10)
- # This has to be last to ensure that resources are cleaned up properly!
- super(AdminSeleniumWebDriverTestCase, cls).setUpClass()
-
- @classmethod
- def _tearDownClassInternal(cls):
- if hasattr(cls, 'selenium'):
- cls.selenium.quit()
- super(AdminSeleniumWebDriverTestCase, cls)._tearDownClassInternal()
def wait_until(self, callback, timeout=10):
"""