diff options
| author | Amar <100243770+aadeina@users.noreply.github.com> | 2026-03-01 01:58:57 +0000 |
|---|---|---|
| committer | Jacob Walls <jacobtylerwalls@gmail.com> | 2026-04-22 10:14:40 -0400 |
| commit | e1bdebc84ee7cacd40b820e862fd504054619403 (patch) | |
| tree | efa42c775ad27e6cc681877ee27eaff18b3e27c7 /tests | |
| parent | 84db026228413dda4cd195464554d51c0b208e32 (diff) | |
Fixed #35943 -- Replaced unload event listener with pagehide.
Co-authored-by: Peter van der Does <peter@oneilinteractive.com>
Co-authored-by: Jacob Walls <jacobtylerwalls@gmail.com>
Diffstat (limited to 'tests')
| -rw-r--r-- | tests/admin_views/test_related_object_lookups.py | 25 |
1 files changed, 25 insertions, 0 deletions
diff --git a/tests/admin_views/test_related_object_lookups.py b/tests/admin_views/test_related_object_lookups.py index 968558491c..2e6c0d07bd 100644 --- a/tests/admin_views/test_related_object_lookups.py +++ b/tests/admin_views/test_related_object_lookups.py @@ -1,3 +1,5 @@ +from selenium.common.exceptions import TimeoutException + from django.contrib.admin.tests import AdminSeleniumTestCase from django.contrib.auth.models import User from django.test import override_settings @@ -179,3 +181,26 @@ class SeleniumTests(AdminSeleniumTestCase): m2m_to.get_attribute("innerHTML"), f"""<option title="{name}" value="{id_value}">{name}</option>""", ) + + def test_child_popup_not_closed_when_parent_minimized(self): + from selenium.webdriver.common.by import By + + album_add_url = reverse("admin:admin_views_album_add") + self.selenium.get(self.live_server_url + album_add_url) + + # Open a popup window using the "+" icon next to the "owner" field. + self.selenium.find_element(By.ID, "add_id_owner").click() + self.wait_for_and_switch_to_popup() + + # Minimize the main window. + self.selenium.switch_to.window(self.selenium.window_handles[0]) + self.wait_page_ready() + self.selenium.minimize_window() + + # The popup should not be closed by dismissChildPopups(). + try: + self.wait_until(lambda d: len(d.window_handles) == 1, 1) + except TimeoutException: + pass # expected + else: + self.fail("The popup was unexpectedly closed.") |
