1
0
mirror of https://github.com/django/django.git synced 2025-09-10 11:09:12 +00:00

Triggered window resize to fix layout issues.

This commit is contained in:
Sarah Boyce 2025-07-16 12:20:41 +02:00
parent e767bd6838
commit 6aa05fd232
3 changed files with 12 additions and 3 deletions

View File

@ -148,6 +148,14 @@ class AdminSeleniumTestCase(SeleniumTestCase, StaticLiveServerTestCase):
self.wait_page_ready(timeout=timeout) self.wait_page_ready(timeout=timeout)
def trigger_resize(self):
width = self.selenium.get_window_size()["width"]
height = self.selenium.get_window_size()["height"]
self.selenium.set_window_size(width + 1, height)
self.wait_page_ready()
self.selenium.set_window_size(width, height)
self.wait_page_ready()
def admin_login(self, username, password, login_url="/admin/"): def admin_login(self, username, password, login_url="/admin/"):
""" """
Log in to the admin. Log in to the admin.

View File

@ -6204,6 +6204,7 @@ class SeleniumTests(AdminSeleniumTestCase):
user = User.objects.create_user(username="new", password="newuser") user = User.objects.create_user(username="new", password="newuser")
url = self.live_server_url + reverse("admin:auth_user_change", args=[user.id]) url = self.live_server_url + reverse("admin:auth_user_change", args=[user.id])
self.selenium.get(url) self.selenium.get(url)
self.trigger_resize()
# Scroll to the User permissions section. # Scroll to the User permissions section.
user_permissions = self.selenium.find_element( user_permissions = self.selenium.find_element(
@ -6243,9 +6244,8 @@ class SeleniumTests(AdminSeleniumTestCase):
).perform() ).perform()
# Move focus to other element. # Move focus to other element.
self.selenium.find_element( body = self.selenium.find_element(By.TAG_NAME, "body")
By.CSS_SELECTOR, "#id_user_permissions_selected_input" body.send_keys(Keys.TAB)
).click()
self.take_screenshot("selectbox-chosen-perms-some-selected") self.take_screenshot("selectbox-chosen-perms-some-selected")
@screenshot_cases(["desktop_size", "mobile_size", "rtl", "dark", "high_contrast"]) @screenshot_cases(["desktop_size", "mobile_size", "rtl", "dark", "high_contrast"])

View File

@ -1541,6 +1541,7 @@ class HorizontalVerticalFilterSeleniumTests(AdminWidgetSeleniumTestCase):
) )
self.wait_page_ready() self.wait_page_ready()
self.trigger_resize()
self.execute_basic_operations("vertical", "students") self.execute_basic_operations("vertical", "students")
self.execute_basic_operations("horizontal", "alumni") self.execute_basic_operations("horizontal", "alumni")