Skip to content

Commit 63ce379

Browse files
committed
[fix] Fixes by @coderabbitai
1 parent 7ea2118 commit 63ce379

File tree

1 file changed

+6
-18
lines changed

1 file changed

+6
-18
lines changed

openwisp_controller/config/tests/test_selenium.py

Lines changed: 6 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -405,7 +405,6 @@ def test_relevant_templates_duplicates(self):
405405
1. User with custom group permissions can access the admin
406406
2. Multiple shared templates are displayed correctly
407407
3. Each template appears only once in the sortedm2m list
408-
4. Default template is automatically selected
409408
"""
410409
# Define permission codenames for the custom group
411410
permission_codenames = [
@@ -466,25 +465,14 @@ def test_relevant_templates_duplicates(self):
466465
)
467466

468467
with self.subTest(
469-
"Verify checkbox HTML elements are present in page source"
470-
" with correct attributes"
468+
"Verify checkbox inputs are rendered with expected attributes"
471469
):
472-
page_source = self.web_driver.page_source
473-
# Verify HTML element strings for each template
474-
for idx, template_id in enumerate([template1.id, template2.id], start=0):
475-
html_element = (
476-
f'<input type="checkbox" value="{template_id}" '
477-
f'id="id_config-templates_{idx}" class="sortedm2m"'
478-
' data-required="false"'
479-
)
480-
self.assertIn(
481-
html_element,
482-
page_source,
483-
(
484-
f"Expected checkbox HTML for template {template_id} not found"
485-
" in page source"
486-
),
470+
for idx, template_id in enumerate([template1.id, template2.id]):
471+
checkbox = self.find_element(
472+
by=By.ID, value=f"id_config-templates_{idx}"
487473
)
474+
self.assertEqual(checkbox.get_attribute("value"), str(template_id))
475+
self.assertEqual(checkbox.get_attribute("data-required"), "false")
488476

489477
with self.subTest("Save operation completes successfully"):
490478
# Scroll to the top of the page to ensure the save button is visible

0 commit comments

Comments
 (0)