1
0
mirror of https://github.com/django/django.git synced 2024-12-22 17:16:24 +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")
@screenshot_cases(["desktop_size", "mobile_size", "rtl", "dark", "high_contrast"])
def test_error_message_position(self):
"""Error messages are shown above the field and below the label"""
def test_error_message(self):
from selenium.webdriver.common.by import By
url = reverse("admin:admin_views_article_add")
full_url = self.live_server_url + url
self.admin_login(
username="super", password="secret", login_url=reverse("admin:index")
)
self.selenium.get(full_url)
# Submit an empty form to trigger validation errors
self.selenium.find_element(By.CSS_SELECTOR, 'input[type="submit"]').click()
self.wait_page_ready()
with self.wait_page_loaded():
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()
error = self.selenium.find_elements(By.CSS_SELECTOR, ".errornote")
self.assertEqual(len(error), 1)
self.take_screenshot("error-message-position")
def test_cancel_delete_confirmation(self):