Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

[1.6.x] Added Chrome/IE support for a selenium test.

Backport of 5954aa6 from master plus additional changes...
  • Loading branch information...
commit 04d827a7103f6e88e204ca0b6412a4a0443e8617 1 parent 9be56ec
@timgraham timgraham authored
Showing with 15 additions and 7 deletions.
  1. +15 −7 tests/view_tests/tests/test_i18n.py
View
22 tests/view_tests/tests/test_i18n.py
@@ -11,14 +11,10 @@
from django.test.utils import override_settings
from django.utils import six, unittest
from django.utils._os import upath
+from django.utils.module_loading import import_by_path
from django.utils.translation import override
from django.utils.text import javascript_quote
-try:
- from selenium.webdriver.firefox import webdriver as firefox
-except ImportError:
- firefox = None
-
from ..urls import locale_dir
@@ -181,15 +177,19 @@ def testI18NWithLocalePaths(self):
@unittest.skipIf(skip_selenium, 'Selenium tests not requested')
-@unittest.skipUnless(firefox, 'Selenium not installed')
class JavascriptI18nTests(LiveServerTestCase):
available_apps = []
urls = 'view_tests.urls'
+ webdriver_class = 'selenium.webdriver.firefox.webdriver.WebDriver'
@classmethod
def setUpClass(cls):
- cls.selenium = firefox.WebDriver()
+ try:
+ cls.selenium = import_by_path(cls.webdriver_class)()
+ except Exception as e:
+ raise unittest.SkipTest('Selenium webdriver "%s" not installed or '
+ 'not operational: %s' % (cls.webdriver_class, str(e)))
super(JavascriptI18nTests, cls).setUpClass()
@classmethod
@@ -222,3 +222,11 @@ def test_escaping(self):
# Force a language via GET otherwise the gettext functions are a noop!
response = self.client.get('/jsi18n_admin/?language=de')
self.assertContains(response, '\\x04')
+
+
+class JavascriptI18nChromeTests(JavascriptI18nTests):
+ webdriver_class = 'selenium.webdriver.chrome.webdriver.WebDriver'
+
+
+class JavascriptI18nIETests(JavascriptI18nTests):
+ webdriver_class = 'selenium.webdriver.ie.webdriver.WebDriver'

0 comments on commit 04d827a

Please sign in to comment.
Something went wrong with that request. Please try again.