diff options
author | Carlton Gibson <carlton.gibson@noumenal.es> | 2021-10-20 14:36:13 +0200 |
---|---|---|
committer | Carlton Gibson <carlton.gibson@noumenal.es> | 2021-10-21 14:37:16 +0200 |
commit | 8fa974fcdde90b6719a1058e77541389ff1809b5 (patch) | |
tree | 79ada45a58e9121e74a67d23ce4b31402c1d1e78 /tests/admin_widgets | |
parent | 45f48ed4f7dda33c536ae14a72c26dc5574c8312 (diff) | |
download | django-8fa974fcdde90b6719a1058e77541389ff1809b5.tar.gz |
Refs #33211 -- Added assertCountSeleniumElements() test helper.
Diffstat (limited to 'tests/admin_widgets')
-rw-r--r-- | tests/admin_widgets/tests.py | 8 |
1 files changed, 3 insertions, 5 deletions
diff --git a/tests/admin_widgets/tests.py b/tests/admin_widgets/tests.py index 3a57227caa..b79f6e0903 100644 --- a/tests/admin_widgets/tests.py +++ b/tests/admin_widgets/tests.py @@ -992,7 +992,7 @@ class DateTimePickerShortcutsSeleniumTests(AdminWidgetSeleniumTestCase): # Warning: This would effectively fail if the TIME_ZONE defined in the # settings has the same UTC offset as "Asia/Singapore" because the # mismatch warning would be rightfully missing from the page. - self.selenium.find_elements_by_css_selector('.field-birthdate .timezonewarning') + self.assertCountSeleniumElements('.field-birthdate .timezonewarning', 1) # Submit the form. with self.wait_page_loaded(): @@ -1322,8 +1322,7 @@ class HorizontalVerticalFilterSeleniumTests(AdminWidgetSeleniumTestCase): change_url = reverse('admin:admin_widgets_school_change', args=(self.school.id,)) self.selenium.get(self.live_server_url + change_url) - options_len = len(self.selenium.find_elements_by_css_selector('#id_students_to > option')) - self.assertEqual(options_len, 2) + self.assertCountSeleniumElements('#id_students_to > option', 2) # self.selenium.refresh() or send_keys(Keys.F5) does hard reload and # doesn't replicate what happens when a user clicks the browser's @@ -1331,8 +1330,7 @@ class HorizontalVerticalFilterSeleniumTests(AdminWidgetSeleniumTestCase): with self.wait_page_loaded(): self.selenium.execute_script("location.reload()") - options_len = len(self.selenium.find_elements_by_css_selector('#id_students_to > option')) - self.assertEqual(options_len, 2) + self.assertCountSeleniumElements('#id_students_to > option', 2) class AdminRawIdWidgetSeleniumTests(AdminWidgetSeleniumTestCase): |