perf: shorten fixed waits in MassHealth claim submit worker

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
This commit is contained in:
2026-09-25 23:52:03 -04:00
co-authored by Claude Sonnet 5
parent 90f587ac9d
commit ef919a2a2f
@@ -291,15 +291,15 @@ class AutomationMassHealthClaimsLogin:
(By.XPATH, "//input[@name='dateInput' and @placeholder='mm/dd/yyyy' and @ng-model='date']")
)
)
time.sleep(1)
time.sleep(0.3)
# Use JavaScript to set the value directly to avoid date picker interference
self.driver.execute_script(f"arguments[0].value = '{formatted_dob}'; arguments[0].dispatchEvent(new Event('input', {{ bubbles: true }})); arguments[0].dispatchEvent(new Event('change', {{ bubbles: true }}));", dob_input)
time.sleep(1)
time.sleep(0.3)
# Press Tab to move to next field and ensure the date is set
dob_input.send_keys(Keys.TAB)
time.sleep(1)
time.sleep(0.3)
# Step 2: Fill Member Number
if self.memberId:
@@ -309,15 +309,15 @@ class AutomationMassHealthClaimsLogin:
(By.XPATH, "//input[@placeholder='Member Number' and @ng-model='vm.number']")
)
)
time.sleep(1)
time.sleep(0.3)
member_input.click()
time.sleep(1)
time.sleep(0.3)
member_input.clear()
time.sleep(1)
time.sleep(0.3)
member_input.send_keys(self.memberId)
time.sleep(1)
time.sleep(0.3)
member_input.send_keys(Keys.TAB)
time.sleep(1)
time.sleep(0.3)
# Step 3: Fill First Name and Last Name
# if self.firstName:
@@ -383,12 +383,12 @@ class AutomationMassHealthClaimsLogin:
(By.XPATH, "//input[@ng-model='serviceLine.procedure' and @placeholder='Code']")
)
)
time.sleep(1)
time.sleep(0.3)
# Step 2: Type the procedure code to trigger typeahead
procedure_input.clear()
procedure_input.send_keys(self.procedureCode)
time.sleep(3) # Wait for typeahead to load
time.sleep(0.5) # brief debounce; the dropdown wait below does the real waiting
# Step 3: Look for the typeahead dropdown and select the first option
# The dropdown appears as ul with class 'dropdown-menu'
@@ -405,13 +405,13 @@ class AutomationMassHealthClaimsLogin:
if first_option:
print("DEBUG: Found first option in procedure dropdown, clicking...")
first_option.click()
time.sleep(2)
time.sleep(0.5)
return "Success"
except:
# If no dropdown appears, just press Tab to move to next field
print("DEBUG: No procedure dropdown found, pressing Tab")
procedure_input.send_keys(Keys.TAB)
time.sleep(1)
time.sleep(0.3)
return "Success"
return "Success"
@@ -433,16 +433,16 @@ class AutomationMassHealthClaimsLogin:
(By.XPATH, "//input[@ng-model='serviceLine.toothCode' and @placeholder='Tooth']")
)
)
time.sleep(1)
time.sleep(0.3)
# Step 2: Type the tooth number
tooth_input.clear()
tooth_input.send_keys(tooth_value.upper()) # Convert to uppercase as per onkeyup
time.sleep(2)
time.sleep(0.5)
# Press Tab to move to next field
tooth_input.send_keys(Keys.TAB)
time.sleep(1)
time.sleep(0.3)
return "Success"
except Exception as e:
@@ -463,16 +463,16 @@ class AutomationMassHealthClaimsLogin:
(By.XPATH, "//input[@ng-model='serviceLine.surface' and @placeholder='Surface']")
)
)
time.sleep(1)
time.sleep(0.3)
# Step 2: Type the tooth surface (convert to uppercase)
surface_input.clear()
surface_input.send_keys(surface_value.upper())
time.sleep(2)
time.sleep(0.5)
# Press Tab to move to next field
surface_input.send_keys(Keys.TAB)
time.sleep(1)
time.sleep(0.3)
return "Success"
except Exception as e:
@@ -491,12 +491,12 @@ class AutomationMassHealthClaimsLogin:
(By.XPATH, "//select[@ng-model='serviceLine.quadrant']")
)
)
time.sleep(1)
time.sleep(0.3)
# Step 2: Use Select class to choose Upper Right
select = Select(quadrant_dropdown)
select.select_by_visible_text("Upper Right")
time.sleep(2)
time.sleep(0.5)
return "Success"
except Exception as e:
@@ -515,12 +515,12 @@ class AutomationMassHealthClaimsLogin:
(By.XPATH, "//select[@ng-model='serviceLine.arch']")
)
)
time.sleep(1)
time.sleep(0.3)
# Step 2: Use Select class to choose Entire Oral Cavity
select = Select(arch_dropdown)
select.select_by_visible_text("Entire Oral Cavity")
time.sleep(2)
time.sleep(0.5)
return "Success"
except Exception as e:
@@ -541,16 +541,16 @@ class AutomationMassHealthClaimsLogin:
(By.XPATH, "//input[@ng-model='serviceLine.authorizationNumber' and @placeholder='No.']")
)
)
time.sleep(1)
time.sleep(0.3)
# Step 2: Type the authorization number
auth_input.clear()
auth_input.send_keys(auth_number)
time.sleep(2)
time.sleep(0.5)
# Press Tab to move to next field
auth_input.send_keys(Keys.TAB)
time.sleep(1)
time.sleep(0.3)
return "Success"
except Exception as e: