diff options
| author | Julien Phalip <jphalip@gmail.com> | 2012-02-23 08:07:07 +0000 |
|---|---|---|
| committer | Julien Phalip <jphalip@gmail.com> | 2012-02-23 08:07:07 +0000 |
| commit | f2de5f4caba819fad10a78bfec47ae6f29cc2c29 (patch) | |
| tree | 283180d05e849bc9406127dee1b03f8fd370d8e5 /django | |
| parent | 6daad896fb616bbcd3171a04c00442294fa84173 (diff) | |
Added some Selenium tests for the admin's filter_horizontal and filter_vertical widgets. Ref #13614, #15220.
git-svn-id: http://code.djangoproject.com/svn/django/trunk@17579 bcc190cf-cafb-0310-a4f2-bffc1f526a37
Diffstat (limited to 'django')
| -rw-r--r-- | django/contrib/admin/tests.py | 22 |
1 files changed, 16 insertions, 6 deletions
diff --git a/django/contrib/admin/tests.py b/django/contrib/admin/tests.py index efe601e723..eb04b40d15 100644 --- a/django/contrib/admin/tests.py +++ b/django/contrib/admin/tests.py @@ -73,15 +73,25 @@ class AdminSeleniumWebDriverTestCase(LiveServerTestCase): return self.selenium.execute_script( 'return django.jQuery("%s").css("%s")' % (selector, attribute)) - def select_option(self, selector, value): + def get_select_option(self, selector, value): """ - Helper function to select the <OPTION> that has the value `value` and - that is in the <SELECT> widget identified by the CSS selector `selector`. + Returns the <OPTION> with the value `value` inside the <SELECT> widget + identified by the CSS selector `selector`. """ from selenium.common.exceptions import NoSuchElementException options = self.selenium.find_elements_by_css_selector('%s option' % selector) for option in options: if option.get_attribute('value') == value: - option.click() - return - raise NoSuchElementException('Option "%s" not found in "%s"' % (value, selector))
\ No newline at end of file + return option + raise NoSuchElementException('Option "%s" not found in "%s"' % (value, selector)) + + def assertSelectOptions(self, selector, values): + """ + Asserts that the <SELECT> widget identified by `selector` has the + options with the given `values`. + """ + options = self.selenium.find_elements_by_css_selector('%s option' % selector) + actual_values = [] + for option in options: + actual_values.append(option.get_attribute('value')) + self.assertEqual(values, actual_values)
\ No newline at end of file |
