84 lines
3.9 KiB
Python
84 lines
3.9 KiB
Python
import time, json
|
|
from pathlib import Path
|
|
from playwright.sync_api import sync_playwright
|
|
|
|
TS = time.strftime("%Y%m%d-%H%M%S")
|
|
OUT = Path(f"/var/www/html/test-report/final-sync-all-{TS}")
|
|
OUT.mkdir(parents=True, exist_ok=True)
|
|
results = {"ts": TS, "captures": []}
|
|
|
|
try:
|
|
with sync_playwright() as p:
|
|
browser = p.chromium.launch(headless=True, args=["--no-sandbox"])
|
|
ctx = browser.new_context(
|
|
viewport={"width":1600,"height":1100},
|
|
ignore_https_errors=True,
|
|
record_video_dir=str(OUT),
|
|
record_video_size={"width":1600,"height":1100}
|
|
)
|
|
page = ctx.new_page()
|
|
|
|
# 1. WTP (synced 906)
|
|
page.goto("https://weval-consulting.com/weval-technology-platform.html?final=" + TS, wait_until="networkidle", timeout=20000)
|
|
time.sleep(7)
|
|
page.screenshot(path=str(OUT/"01-WTP-906.png"), full_page=True)
|
|
# Extract agent gauge
|
|
val = page.evaluate("""() => {
|
|
const el = document.getElementById('vm-gauge-agents');
|
|
return el ? el.innerText : 'NOT_FOUND';
|
|
}""")
|
|
results["captures"].append({"page":"WTP", "agents":val[:50]})
|
|
print(f" ✓ WTP: agents={val[:50]}")
|
|
|
|
# 2. Enterprise Complete (synced)
|
|
page.goto("https://weval-consulting.com/enterprise-complete.html?final=" + TS, wait_until="networkidle", timeout=20000)
|
|
time.sleep(6)
|
|
page.screenshot(path=str(OUT/"02-enterprise-complete-906.png"), full_page=True)
|
|
k_agents = page.evaluate("document.getElementById('k-agents')?.textContent")
|
|
results["captures"].append({"page":"enterprise-complete", "k_agents":k_agents})
|
|
print(f" ✓ enterprise-complete: k-agents={k_agents}")
|
|
|
|
# 3. Unified Hub v2
|
|
page.goto("https://weval-consulting.com/wevia-unified-hub.html?final=" + TS, wait_until="networkidle", timeout=20000)
|
|
time.sleep(6)
|
|
page.screenshot(path=str(OUT/"03-unified-hub.png"), full_page=True)
|
|
hub_agents = page.evaluate("[...document.querySelectorAll('.kpi .v')].map(e=>e.innerText)[0]")
|
|
results["captures"].append({"page":"unified-hub", "agents":hub_agents})
|
|
print(f" ✓ unified-hub: agents={hub_agents}")
|
|
|
|
# 4. Training (legacy via source-of-truth)
|
|
page.goto("https://weval-consulting.com/wevia-training.html?final=" + TS, wait_until="networkidle", timeout=20000)
|
|
time.sleep(7)
|
|
page.screenshot(path=str(OUT/"04-training-synced.png"), full_page=True)
|
|
t_val = page.evaluate("document.getElementById('vm-agt-val')?.textContent")
|
|
results["captures"].append({"page":"training", "svg_agents":t_val})
|
|
print(f" ✓ training: svg_agents={t_val}")
|
|
|
|
# 5. Autonomy Dashboard
|
|
page.goto("https://weval-consulting.com/wevia-autonomy-dashboard.html?final=" + TS, wait_until="networkidle", timeout=20000)
|
|
time.sleep(6)
|
|
page.screenshot(path=str(OUT/"05-autonomy-dashboard.png"), full_page=True)
|
|
aut_score = page.evaluate("""() => {
|
|
const el = document.querySelector('.autonomy-score-box .score, [class*=score]');
|
|
return el ? el.innerText.slice(0, 20) : 'X';
|
|
}""")
|
|
results["captures"].append({"page":"autonomy-dashboard", "score":aut_score})
|
|
print(f" ✓ autonomy: score={aut_score}")
|
|
|
|
ctx.close()
|
|
browser.close()
|
|
|
|
videos = list(OUT.glob("*.webm"))
|
|
results["video"] = videos[0].name if videos else None
|
|
pngs = list(OUT.glob("*.png"))
|
|
results["screenshots"] = len(pngs)
|
|
results["total_size"] = sum(p.stat().st_size for p in pngs)
|
|
print(f"\n ✓ video={results['video']}")
|
|
print(f" ✓ screenshots={results['screenshots']} total={results['total_size']}b")
|
|
|
|
with open(OUT/"results.json","w") as f:
|
|
json.dump(results, f, indent=2, default=str)
|
|
print(json.dumps(results, indent=2, default=str)[:1500])
|
|
except Exception as e:
|
|
print(f"err: {e}")
|