diff options
Diffstat (limited to 'tests/admin_views')
| -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.") |
