168 lines
7.1 KiB
Python
168 lines
7.1 KiB
Python
|
|
from playwright.sync_api import sync_playwright
|
|
import json, os, time
|
|
|
|
os.makedirs('/var/www/html/api/screenshots', exist_ok=True)
|
|
os.makedirs('/opt/weval-l99/videos/growth-v2', exist_ok=True)
|
|
results = []
|
|
BASE = "https://weval-consulting.com"
|
|
|
|
with sync_playwright() as p:
|
|
b = p.chromium.launch(headless=True, args=['--no-sandbox','--disable-web-security','--ignore-certificate-errors'])
|
|
ctx = b.new_context(viewport={"width":1920,"height":1080}, ignore_https_errors=True,
|
|
record_video_dir="/opt/weval-l99/videos/growth-v2",
|
|
record_video_size={"width":1920,"height":1080})
|
|
pg = ctx.new_page()
|
|
|
|
# === agents-archi (PUBLIC) ===
|
|
print("TEST: agents-archi.html")
|
|
pg.goto(f"{BASE}/agents-archi.html", timeout=30000)
|
|
time.sleep(6)
|
|
pg.screenshot(path="/var/www/html/api/screenshots/T1-agents-archi.png")
|
|
growth = "Growth" in (pg.evaluate("document.body.innerText") or "")
|
|
canvas = pg.evaluate("!!document.querySelector('canvas')")
|
|
cards = pg.evaluate("document.querySelectorAll('.ag-card').length")
|
|
results.append({"test":"agents-archi-loaded","ok":True})
|
|
results.append({"test":"agents-archi-growth-visible","ok":growth})
|
|
results.append({"test":"agents-archi-3d-canvas","ok":canvas})
|
|
results.append({"test":"agents-archi-cards","ok":cards>15,"d":f"{cards}"})
|
|
print(f" Growth:{growth} Canvas:{canvas} Cards:{cards}")
|
|
|
|
# Cinematic: scroll, wait, interact
|
|
for i in range(4):
|
|
time.sleep(3)
|
|
pg.screenshot(path=f"/var/www/html/api/screenshots/T1-cinema-{i}.png")
|
|
|
|
# Click Growth agent if found
|
|
try:
|
|
pg.evaluate("document.querySelectorAll('.ag-card').forEach(c=>{if(c.textContent.includes('Growth'))c.click()})")
|
|
time.sleep(2)
|
|
pg.screenshot(path="/var/www/html/api/screenshots/T1-growth-click.png")
|
|
results.append({"test":"agents-archi-growth-click","ok":True})
|
|
except:
|
|
results.append({"test":"agents-archi-growth-click","ok":False})
|
|
|
|
# === enterprise-model (PUBLIC) ===
|
|
print("TEST: enterprise-model.html")
|
|
pg.goto(f"{BASE}/enterprise-model.html", timeout=30000)
|
|
time.sleep(6)
|
|
pg.screenshot(path="/var/www/html/api/screenshots/T2-enterprise.png")
|
|
growth_e = "Growth" in (pg.evaluate("document.body.innerText") or "")
|
|
canvas_e = pg.evaluate("!!document.querySelector('canvas')")
|
|
results.append({"test":"enterprise-loaded","ok":True})
|
|
results.append({"test":"enterprise-growth","ok":growth_e})
|
|
results.append({"test":"enterprise-3d","ok":canvas_e})
|
|
print(f" Growth:{growth_e} Canvas:{canvas_e}")
|
|
|
|
for i in range(4):
|
|
time.sleep(3)
|
|
pg.screenshot(path=f"/var/www/html/api/screenshots/T2-cinema-{i}.png")
|
|
|
|
# === meeting-rooms (PUBLIC) ===
|
|
print("TEST: wevia-meeting-rooms.html")
|
|
pg.goto(f"{BASE}/wevia-meeting-rooms.html", timeout=30000)
|
|
time.sleep(6)
|
|
pg.screenshot(path="/var/www/html/api/screenshots/T3-meeting.png")
|
|
growth_m = "Growth" in (pg.evaluate("document.body.innerText") or "")
|
|
canvas_m = pg.evaluate("!!document.querySelector('canvas')")
|
|
results.append({"test":"meeting-loaded","ok":True})
|
|
results.append({"test":"meeting-growth","ok":growth_m})
|
|
results.append({"test":"meeting-3d","ok":canvas_m})
|
|
print(f" Growth:{growth_m} Canvas:{canvas_m}")
|
|
|
|
for i in range(4):
|
|
time.sleep(3)
|
|
pg.screenshot(path=f"/var/www/html/api/screenshots/T3-cinema-{i}.png")
|
|
|
|
# === growth-engine (AUTH REQUIRED) ===
|
|
print("TEST: growth-engine.html (with auth)")
|
|
# Login first
|
|
pg.goto(f"{BASE}/auth/login.php", timeout=10000)
|
|
time.sleep(1)
|
|
try:
|
|
pg.fill("input[name=user]", "yacine")
|
|
pg.fill("input[name=pass]", "Weval@2026")
|
|
pg.click("button[type=submit]")
|
|
time.sleep(2)
|
|
results.append({"test":"auth-login","ok":True})
|
|
except:
|
|
# Try alternate login
|
|
try:
|
|
pg.goto(f"{BASE}/login", timeout=10000)
|
|
time.sleep(1)
|
|
pg.fill("input[name=user]", "yacine")
|
|
pg.fill("input[name=pass]", "Weval@2026")
|
|
pg.click("button[type=submit]")
|
|
time.sleep(2)
|
|
results.append({"test":"auth-login","ok":True})
|
|
except Exception as e:
|
|
results.append({"test":"auth-login","ok":False,"d":str(e)[:60]})
|
|
|
|
pg.goto(f"{BASE}/growth-engine.html", timeout=15000)
|
|
time.sleep(3)
|
|
pg.screenshot(path="/var/www/html/api/screenshots/T4-growth.png")
|
|
|
|
body = pg.evaluate("document.body.innerText") or ""
|
|
has_ge = "Growth" in body or "Dashboard" in body or "Engine" in body
|
|
kpis = pg.evaluate("document.querySelectorAll('.kpi').length")
|
|
pipe = pg.evaluate("document.querySelectorAll('.pipe-col').length")
|
|
chat = pg.evaluate("!!document.querySelector('.chat-box') || !!document.querySelector('.chat-panel')")
|
|
results.append({"test":"growth-loaded","ok":has_ge})
|
|
results.append({"test":"growth-kpis","ok":kpis>=4,"d":str(kpis)})
|
|
results.append({"test":"growth-pipeline","ok":pipe>=3,"d":str(pipe)})
|
|
results.append({"test":"growth-chat","ok":chat})
|
|
print(f" Loaded:{has_ge} KPIs:{kpis} Pipeline:{pipe} Chat:{chat}")
|
|
|
|
# Tabs
|
|
for tab in ['opportunities','actions','assets','intel']:
|
|
try:
|
|
pg.evaluate(f"document.querySelectorAll('.tab').forEach(t=>{{if(t.dataset&&t.dataset.t==='{tab}')t.click()}})")
|
|
time.sleep(1.5)
|
|
pg.screenshot(path=f"/var/www/html/api/screenshots/T4-tab-{tab}.png")
|
|
results.append({"test":f"growth-tab-{tab}","ok":True})
|
|
except:
|
|
results.append({"test":f"growth-tab-{tab}","ok":False})
|
|
|
|
# Chat test
|
|
try:
|
|
inp = pg.query_selector("#chatIn") or pg.query_selector("#chatInput")
|
|
if inp:
|
|
inp.fill("scan complet")
|
|
btn = pg.query_selector(".chat-input button")
|
|
if btn: btn.click()
|
|
time.sleep(6)
|
|
pg.screenshot(path="/var/www/html/api/screenshots/T4-chat-response.png")
|
|
results.append({"test":"growth-chat-interaction","ok":True})
|
|
except:
|
|
results.append({"test":"growth-chat-interaction","ok":False})
|
|
|
|
# Scan button
|
|
try:
|
|
scan = pg.query_selector(".scan-btn")
|
|
if scan:
|
|
scan.click()
|
|
time.sleep(8)
|
|
pg.screenshot(path="/var/www/html/api/screenshots/T4-scan-result.png")
|
|
results.append({"test":"growth-scan","ok":True})
|
|
except:
|
|
results.append({"test":"growth-scan","ok":False})
|
|
|
|
ctx.close()
|
|
b.close()
|
|
|
|
# Results
|
|
passed = sum(1 for r in results if r['ok'])
|
|
total = len(results)
|
|
print(f"\nSCORE: {passed}/{total} ({round(passed/total*100) if total else 0}%)")
|
|
for r in results:
|
|
print(f" {'PASS' if r['ok'] else 'FAIL'} {r['test']} {r.get('d','')}")
|
|
|
|
json.dump({"results":results,"passed":passed,"total":total,"ts":time.strftime("%c")},
|
|
open("/opt/weval-l99/growth-visual-test-results.json","w"), indent=2)
|
|
|
|
vids = [f for f in os.listdir("/opt/weval-l99/videos/growth-v2") if f.endswith('.webm')]
|
|
print(f"\n{len(vids)} video(s)")
|
|
for v in vids:
|
|
sz = os.path.getsize(f"/opt/weval-l99/videos/growth-v2/{v}")
|
|
print(f" {v}: {round(sz/1024/1024,1)}MB")
|