Skip to content

Commit ce9b15b

Browse files
Addressing SonarQube issues
1 parent 31a3f45 commit ce9b15b

File tree

2 files changed

+10
-5
lines changed

2 files changed

+10
-5
lines changed

tests/regression/regression_tests/test_regression_test_setup_steps.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,12 +16,11 @@
1616
set_org_parameter_value,
1717
check_parameter,
1818
)
19-
from utils.dataset_field_util import DatasetFieldUtil
2019

2120
from utils.oracle.oracle import OracleDB
2221

2322

24-
def test_allow_10_minute_colonsocopy_assessment_Appointments(page: Page) -> None:
23+
def test_allow_10_minute_colonsocopy_assessment_appointments(page: Page) -> None:
2524
"""
2625
Scenario: 1: Allow 10 minute colonoscopy assessment appointments between 7am and 8pm at BCS001
2726

utils/table_util.py

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,8 @@ def __init__(self, page: Page, table_locator: str) -> None:
2525
table_locator
2626
) # Create a locator object for the table
2727

28+
self.tbody_tr_string = "tbody tr"
29+
2830
def get_column_index(self, column_name: str) -> int:
2931
"""
3032
Finds the column index dynamically based on column name.
@@ -41,7 +43,9 @@ def get_column_index(self, column_name: str) -> int:
4143
if not header_row.locator("th").count():
4244
# Fallback: look for header in <tbody> if <thead> is missing or empty
4345
header_row = (
44-
self.table.locator("tbody tr").filter(has=self.page.locator("th")).first
46+
self.table.locator(self.tbody_tr_string)
47+
.filter(has=self.page.locator("th"))
48+
.first
4549
)
4650

4751
headers = header_row.locator("th")
@@ -163,7 +167,9 @@ def get_table_headers(self) -> dict:
163167

164168
# Strategy 3: Last resort — try to find header from tbody row (some old tables use <tbody> only)
165169
fallback_row = (
166-
self.table.locator("tbody tr").filter(has=self.page.locator("th")).first
170+
self.table.locator(self.tbody_tr_string)
171+
.filter(has=self.page.locator("th"))
172+
.first
167173
)
168174
if fallback_row.locator("th").count():
169175
try:
@@ -372,7 +378,7 @@ def click_surname_if_bcss_user_and_has_code(self):
372378
if -1 in (surname_col, user_code_col, bcss_col):
373379
raise ValueError("One or more required columns not found")
374380

375-
rows = self.table.locator("tbody tr")
381+
rows = self.table.locator(self.tbody_tr_string)
376382

377383
for i in range(rows.count()):
378384
row = rows.nth(i)

0 commit comments

Comments
 (0)