Viewer loads with no page errors; clicking the lining with other layers hidden returns station, placeholder pattern and lining spec. V12 (original fingerprint) and V14 (independent verification) recorded as not performed. Co-Authored-By: Claude Haiku 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01A5Cun3RHQKna9qxE6ybZ4A
40 lines
1.9 KiB
Python
40 lines
1.9 KiB
Python
#!/usr/bin/env python3
|
|
"""Headless browser check of the 3D viewer (Task 6, V11).
|
|
Needs Playwright + Chromium and the viewer/model served over HTTP, e.g.
|
|
python3 -m http.server 8765 (from Code/3d-drawing)
|
|
python3 verify_viewer_headless.py http://127.0.0.1:8765/viewer/index.html <chromium_path>
|
|
Checks: page loads without page errors, canvas exists, meta text is shown,
|
|
and a click on the lining (other layers hidden) returns station and pattern.
|
|
"""
|
|
import sys
|
|
from playwright.sync_api import sync_playwright
|
|
|
|
URL, CHROME = sys.argv[1], sys.argv[2]
|
|
with sync_playwright() as p:
|
|
b = p.chromium.launch(executable_path=CHROME, args=["--use-gl=swiftshader", "--enable-webgl", "--ignore-gpu-blocklist", "--no-sandbox"])
|
|
pg = b.new_page(viewport={"width": 1280, "height": 800})
|
|
errors = []
|
|
pg.on("pageerror", lambda e: errors.append(str(e)))
|
|
pg.goto(URL, wait_until="networkidle", timeout=90000)
|
|
pg.wait_for_timeout(6000)
|
|
canvas = pg.evaluate("() => !!document.querySelector('canvas')")
|
|
body = pg.evaluate("() => document.body.innerText")
|
|
print("page errors:", errors)
|
|
print("canvas present:", canvas, "| meta shown:", "패턴:" in body and "범위:" in body)
|
|
for label in ["excavation_R7402", "road_surface", "ground_GL"]:
|
|
pg.locator("label", has_text=label).locator("input").uncheck()
|
|
pg.wait_for_timeout(500)
|
|
readout = None
|
|
for fx in [0.5, 0.45, 0.55, 0.4, 0.6, 0.35, 0.65]:
|
|
for fy in [0.5, 0.45, 0.55, 0.4, 0.6]:
|
|
pg.mouse.click(1280 * fx, 800 * fy)
|
|
pg.wait_for_timeout(200)
|
|
t = pg.evaluate("() => { const els=[...document.querySelectorAll('div,pre,p')]; return els.map(e=>e.innerText).filter(s=>s && s.includes('교차점')).pop()||null }")
|
|
if t and "측점" in t:
|
|
readout = t
|
|
break
|
|
if readout:
|
|
break
|
|
print("lining readout:", (readout or "NO LINING HIT").replace("\n", " | ")[:700])
|
|
b.close()
|