add sanity check

This commit is contained in:
gregory 2025-09-02 09:35:20 -04:00
parent 11e58c891e
commit 726f0b11dc

View File

@ -153,8 +153,9 @@ def filter_row_by_date(reservation_row: webelement.WebElement) -> bool:
rows = get_reservation_rows() rows = get_reservation_rows()
print('found ' + str(len(rows)) + ' reservations to add reservation comment to') row_count = len(rows)
for i in range(0, len(rows)): print('found ' + str(row_count) + ' reservations to add reservation comment to')
for i in range(0, row_count):
row = rows[i] row = rows[i]
student_name = row.find_element(By.XPATH, './td[contains(@class, "cdk-column-Customer")]').get_attribute("innerText") student_name = row.find_element(By.XPATH, './td[contains(@class, "cdk-column-Customer")]').get_attribute("innerText")
reservation_date = row.find_element(By.XPATH, './td[contains(@class, "cdk-column-date")]').get_attribute("innerText") reservation_date = row.find_element(By.XPATH, './td[contains(@class, "cdk-column-date")]').get_attribute("innerText")
@ -186,7 +187,7 @@ for i in range(0, len(rows)):
textarea = comments.find_element(By.ID, 'comments') textarea = comments.find_element(By.ID, 'comments')
textarea.clear() textarea.clear()
comment_text = "c172 " + today.strftime('%d %b, %H:%M') comment_text = "c172 " + today.strftime('%d %b %H%M')
print('comment text: ' + comment_text) print('comment text: ' + comment_text)
textarea.send_keys(comment_text) textarea.send_keys(comment_text)
@ -200,5 +201,8 @@ for i in range(0, len(rows)):
driver.find_element(By.XPATH, '//button[contains(@ng-click, "dismissModal()")]').click() driver.find_element(By.XPATH, '//button[contains(@ng-click, "dismissModal()")]').click()
rows = get_reservation_rows() rows = get_reservation_rows()
# If count of reservation rows changes, something is wrong
if len(rows) is not row_count:
die('reservation row count changed, aborting...')
die() die()