Skip to content

Commit

Permalink
Fixed SeleniumTests.test_related_object_update_with_camel_casing() as…
Browse files Browse the repository at this point in the history
…sert.

A selenium web element was compared to a string rather than its innerHTML.
  • Loading branch information
sarahboyce committed Apr 3, 2024
1 parent 8665cf0 commit 89403db
Showing 1 changed file with 4 additions and 5 deletions.
9 changes: 4 additions & 5 deletions tests/admin_views/test_related_object_lookups.py
Original file line number Diff line number Diff line change
Expand Up @@ -80,9 +80,6 @@ def test_related_object_lookup_link_enabled(self):
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"
Expand All @@ -105,15 +102,17 @@ def _get_HTML_inside_element_by_id(id_):

# Check that both the "Available" m2m box and the "Fk" dropdown now
# include the newly added CamelCaseModel instance.
fk_dropdown = self.selenium.find_element(By.ID, "id_fk")
self.assertHTMLEqual(
self.selenium.find_element(By.ID, "id_fk"),
fk_dropdown.get_attribute("innerHTML"),
f"""
<option value="" selected="">---------</option>
<option value="1" selected>{interesting_name}</option>
""",
)
m2m_box = self.selenium.find_element(By.ID, "id_m2m_from")
self.assertHTMLEqual(
self.selenium.find_element(By.ID, "id_m2m_from"),
m2m_box.get_attribute("innerHTML"),
f"""
<option value="1">{interesting_name}</option>
""",
Expand Down

0 comments on commit 89403db

Please sign in to comment.