45 lines
1.8 KiB
Python
45 lines
1.8 KiB
Python
"""L99 Canvas Render Test for agents-archi.html
|
|
Verifies that the Three.js WebGL scene actually renders (not black)
|
|
by checking canvas.toDataURL() length > 5000 bytes
|
|
"""
|
|
import json,sys
|
|
from playwright.sync_api import sync_playwright
|
|
|
|
def test_agents_archi_3d():
|
|
with sync_playwright() as p:
|
|
b=p.chromium.launch(headless=True,args=["--no-sandbox","--use-gl=swiftshader","--enable-webgl"])
|
|
pg=b.new_page(viewport={"width":1920,"height":1080})
|
|
# Login
|
|
pg.goto("https://weval-consulting.com/login",wait_until="networkidle",timeout=15000)
|
|
pg.fill('input[name="user"]',"yacine")
|
|
pg.fill('input[name="pass"]',"Weval@2026")
|
|
pg.click('button[type="submit"]')
|
|
pg.wait_for_load_state("networkidle",timeout=10000)
|
|
# Test page
|
|
pg.goto("https://weval-consulting.com/agents-archi.html",wait_until="networkidle",timeout=20000)
|
|
pg.wait_for_timeout(6000)
|
|
r=pg.evaluate("""()=>{
|
|
const c=document.querySelector('canvas');
|
|
if(!c)return{canvas:false};
|
|
const d=c.toDataURL();
|
|
return{canvas:true,bytes:d.length,cards:document.querySelectorAll('.ag-card').length,w:c.width,h:c.height};
|
|
}""")
|
|
errors=[]
|
|
pg.on("pageerror",lambda e:errors.append(str(e)))
|
|
b.close()
|
|
# Assertions
|
|
assert r.get("canvas"), "NO CANVAS ELEMENT"
|
|
assert r.get("bytes",0)>5000, f"CANVAS EMPTY ({r.get('bytes',0)} bytes)"
|
|
assert r.get("cards",0)>=30, f"MISSING AGENTS ({r.get('cards',0)}/30+)"
|
|
print(f"PASS: canvas={r['bytes']}B cards={r['cards']} {r['w']}x{r['h']}")
|
|
|
|
if __name__=="__main__":
|
|
try:
|
|
test_agents_archi_3d()
|
|
except AssertionError as e:
|
|
print(f"FAIL: {e}")
|
|
sys.exit(1)
|
|
except Exception as e:
|
|
print(f"ERROR: {e}")
|
|
sys.exit(2)
|