|
@@ -76,3 +76,45 @@ class SeleniumTests(AdminSeleniumTestCase):
|
|
|
with self.subTest(link_id):
|
|
|
link = self.selenium.find_element(By.XPATH, f'//*[@id="{link_id}"]')
|
|
|
self.assertIsNone(link.get_attribute("aria-disabled"))
|
|
|
+
|
|
|
+ def test_related_object_update_with_camel_casing(self):
|
|
|
+ from selenium.webdriver.common.by import By
|
|
|
+
|
|
|
+ def _get_HTML_inside_element_by_id(id_):
|
|
|
+ return self.selenium.find_element(By.ID, id_).get_attribute("innerHTML")
|
|
|
+
|
|
|
+ add_url = reverse("admin:admin_views_camelcaserelatedmodel_add")
|
|
|
+ self.selenium.get(self.live_server_url + add_url)
|
|
|
+ interesting_name = "A test name"
|
|
|
+
|
|
|
+ # Add a new CamelCaseModel using the "+" icon next to the "fk" field.
|
|
|
+ self.selenium.find_element(By.ID, "add_id_fk").click()
|
|
|
+
|
|
|
+ # Switch to the add popup window.
|
|
|
+ self.wait_for_and_switch_to_popup()
|
|
|
+
|
|
|
+ # Find the "interesting_name" field and enter a value, then save it.
|
|
|
+ self.selenium.find_element(By.ID, "id_interesting_name").send_keys(
|
|
|
+ interesting_name
|
|
|
+ )
|
|
|
+ self.selenium.find_element(By.NAME, "_save").click()
|
|
|
+
|
|
|
+ # Return to the main window.
|
|
|
+ self.wait_until(lambda d: len(d.window_handles) == 1, 1)
|
|
|
+ self.selenium.switch_to.window(self.selenium.window_handles[0])
|
|
|
+
|
|
|
+ # Check that both the "Available" m2m box and the "Fk" dropdown now
|
|
|
+ # include the newly added CamelCaseModel instance.
|
|
|
+ self.assertHTMLEqual(
|
|
|
+ self.selenium.find_element(By.ID, "id_fk"),
|
|
|
+ f"""
|
|
|
+ <option value="" selected="">---------</option>
|
|
|
+ <option value="1" selected>{interesting_name}</option>
|
|
|
+ """,
|
|
|
+ )
|
|
|
+ self.assertHTMLEqual(
|
|
|
+ self.selenium.find_element(By.ID, "id_m2m_from"),
|
|
|
+ f"""
|
|
|
+ <option value="1">{interesting_name}</option>
|
|
|
+ """,
|
|
|
+ )
|