From e21a7cfc16d7eb2dcd77127f1ea34971dee88e7d Mon Sep 17 00:00:00 2001 From: Marcelo Galigniana Date: Thu, 20 Oct 2022 23:25:33 -0300 Subject: [PATCH] [4.1.x] Fixed flaky test_ForeignKey_using_to_field test. Backport of 1d6948096f6fe7aa887d651e01e9af8e4ef349a2 from main --- tests/admin_widgets/tests.py | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/tests/admin_widgets/tests.py b/tests/admin_widgets/tests.py index cce759a9c8..55f513c0e9 100644 --- a/tests/admin_widgets/tests.py +++ b/tests/admin_widgets/tests.py @@ -1715,7 +1715,12 @@ class RelatedFieldWidgetSeleniumTests(AdminWidgetSeleniumTestCase): self.wait_for_value("#id_username", "newuser") self.selenium.back() + # Chrome and Safari don't update related object links when selecting + # the same option as previously submitted. As a consequence, the + # "pencil" and "eye" buttons remain disable, so select "---------" + # first. select = Select(self.selenium.find_element(By.ID, "id_user")) + select.select_by_index(0) select.select_by_value("newuser") # Click the Change User button to change it self.selenium.find_element(By.ID, "change_id_user").click()