Snapshot of the working project as of 2026-10-23 (local 2d4d4fc), one commit with no earlier history: the tracked files were de-identified first (synthetic claim ids and patient data only; see Context.md section 7). Credentials, run logs, screenshots, claim reports and client workbooks are gitignored and not included. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
105 lines
3.3 KiB
Python
105 lines
3.3 KiB
Python
r"""
|
|
The Dental Claim screen (mapped from live claim 9125000 — DentaQuest) is a
|
|
THIRD claim-form shape, distinct from both the UB form and the
|
|
professional/HCFA "Claim" screen — see dental_claim.html's own comment for
|
|
exactly what differs.
|
|
|
|
python tests\test_dental_claim_skip.py
|
|
|
|
Real bug this guards: before is_dental_claim_form()/SEL_CANCEL_DENTAL
|
|
existed, `open_claim()` waited the full NAV_TIMEOUT (5 minutes) for a
|
|
UB/HCFA marker that never appears on this screen — the same failure shape
|
|
already fixed once for HCFA (claim 9103000) — and `close_claim()` burned
|
|
through every UB/HCFA attempt before giving up with the modal still open,
|
|
ready to collide with the next claim in the loop. No condition in this
|
|
codebase understands the Dental screen's shape (its CPT rows carry no
|
|
CPTROW_ id at all), so the fix is to detect it immediately and skip
|
|
straight to closing, never attempting an extract().
|
|
"""
|
|
|
|
import sys
|
|
import pathlib
|
|
import inspect
|
|
|
|
ROOT = pathlib.Path(__file__).resolve().parent.parent
|
|
sys.path.insert(0, str(ROOT / "src"))
|
|
|
|
FIXTURE = pathlib.Path(__file__).resolve().parent / "fixtures" / "dental_claim.html"
|
|
|
|
from ecw_bot.pages import claim_form # noqa: E402
|
|
from ecw_bot.selectors import claim_form as sel # noqa: E402
|
|
|
|
CASES = []
|
|
|
|
|
|
def case(fn):
|
|
CASES.append(fn)
|
|
return fn
|
|
|
|
|
|
@case
|
|
def is_dental_claim_form_is_true_for_the_dental_screen(page):
|
|
assert claim_form.is_dental_claim_form(page) is True
|
|
|
|
|
|
@case
|
|
def is_ub_claim_form_is_false_for_the_dental_screen(page):
|
|
assert claim_form.is_ub_claim_form(page) is False
|
|
|
|
|
|
@case
|
|
def any_claim_form_open_matches_the_dental_screen(page):
|
|
"""
|
|
The exact selector open_claim() waits on. Before SEL_CANCEL_DENTAL was
|
|
added, this would not match the Dental screen at all, and open_claim()
|
|
would burn the full 5-minute NAV_TIMEOUT waiting for it.
|
|
"""
|
|
assert page.locator(sel.SEL_ANY_CLAIM_FORM_OPEN).first.is_visible()
|
|
|
|
|
|
@case
|
|
def close_claim_uses_the_dental_screens_own_cancel_first(page):
|
|
assert page.locator("#cancelDentalClaimButton").first.is_visible()
|
|
assert claim_form.close_claim(page) is True
|
|
assert not page.locator("#cancelDentalClaimButton").first.is_visible()
|
|
|
|
|
|
def main() -> int:
|
|
if not FIXTURE.exists():
|
|
print(f" FAIL fixture missing: {FIXTURE}")
|
|
return 1
|
|
try:
|
|
from playwright.sync_api import sync_playwright
|
|
except ImportError:
|
|
print(" SKIP playwright is not installed")
|
|
return 0
|
|
|
|
failures = 0
|
|
with sync_playwright() as pw:
|
|
browser = pw.chromium.launch(headless=True)
|
|
page = browser.new_page()
|
|
|
|
for fn in CASES:
|
|
name = fn.__name__.replace("_", " ")
|
|
try:
|
|
page.goto(FIXTURE.as_uri())
|
|
if len(inspect.signature(fn).parameters) == 0:
|
|
fn()
|
|
else:
|
|
fn(page)
|
|
print(f" ok {name}")
|
|
except AssertionError as exc:
|
|
print(f" FAIL {name}: {exc}")
|
|
failures += 1
|
|
except Exception as exc:
|
|
print(f" ERROR {name}: {type(exc).__name__}: {exc}")
|
|
failures += 1
|
|
browser.close()
|
|
|
|
print(f"\n{len(CASES) - failures}/{len(CASES)} passed")
|
|
return 1 if failures else 0
|
|
|
|
|
|
if __name__ == "__main__":
|
|
sys.exit(main())
|