1
0
mirror of https://github.com/django/django.git synced 2024-12-23 01:25:58 +00:00

Apply suggestions from code review

Co-authored-by: Sarah Boyce <42296566+sarahboyce@users.noreply.github.com>
This commit is contained in:
Hrushikesh Vaidya 2024-10-14 05:04:31 +05:30 committed by GitHub
parent 6fbdfe14f6
commit c4c66aa73d
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -6207,19 +6207,22 @@ class SeleniumTests(AdminSeleniumTestCase):
self.take_screenshot("focus-multi-widget") self.take_screenshot("focus-multi-widget")
@screenshot_cases(["desktop_size", "mobile_size", "rtl", "dark", "high_contrast"]) @screenshot_cases(["desktop_size", "mobile_size", "rtl", "dark", "high_contrast"])
def test_error_message_position(self): def test_error_message(self):
"""Error messages are shown above the field and below the label"""
from selenium.webdriver.common.by import By from selenium.webdriver.common.by import By
url = reverse("admin:admin_views_article_add")
full_url = self.live_server_url + url
self.admin_login( self.admin_login(
username="super", password="secret", login_url=reverse("admin:index") username="super", password="secret", login_url=reverse("admin:index")
) )
self.selenium.get(full_url) with self.wait_page_loaded():
# Submit an empty form to trigger validation errors self.selenium.get(
self.live_server_url + reverse("admin:admin_views_picture_add")
)
# Submit an empty form to trigger validation errors.
with self.wait_page_loaded():
self.selenium.find_element(By.CSS_SELECTOR, 'input[type="submit"]').click() self.selenium.find_element(By.CSS_SELECTOR, 'input[type="submit"]').click()
self.wait_page_ready() error = self.selenium.find_elements(By.CSS_SELECTOR, ".errornote")
self.assertEqual(len(error), 1)
self.take_screenshot("error-message-position") self.take_screenshot("error-message-position")
def test_cancel_delete_confirmation(self): def test_cancel_delete_confirmation(self):