287 lines
10 KiB
Plaintext
287 lines
10 KiB
Plaintext
|
|
import time, json, os
|
|
from playwright.sync_api import sync_playwright
|
|
|
|
BASE = "https://weval-consulting.com"
|
|
VIDEO_DIR = "/opt/weval-l99/videos/growth-session"
|
|
SCREENSHOT_DIR = "/var/www/html/api/screenshots"
|
|
os.makedirs(VIDEO_DIR, exist_ok=True)
|
|
os.makedirs(SCREENSHOT_DIR, exist_ok=True)
|
|
|
|
results = []
|
|
def log(name, ok, detail=""):
|
|
results.append({"test": name, "ok": ok, "detail": detail})
|
|
print(f"{'PASS' if ok else 'FAIL'} {name} {detail}")
|
|
|
|
with sync_playwright() as p:
|
|
browser = p.chromium.launch(headless=True, args=['--no-sandbox','--disable-gpu'])
|
|
|
|
# ═══ TEST 1: AGENTS-ARCHI (3D cinématique) ═══
|
|
print("\n" + "="*60)
|
|
print("TEST 1: AGENTS-ARCHI.HTML — 3D + Growth Agent")
|
|
print("="*60)
|
|
|
|
ctx1 = browser.new_context(
|
|
viewport={"width":1920,"height":1080},
|
|
record_video_dir=VIDEO_DIR,
|
|
record_video_size={"width":1920,"height":1080},
|
|
ignore_https_errors=True
|
|
)
|
|
pg = ctx1.new_page()
|
|
|
|
# Auth
|
|
pg.goto(f"{BASE}/login", timeout=15000)
|
|
pg.wait_for_timeout(1000)
|
|
try:
|
|
pg.fill("input[name=user]", "yacine")
|
|
pg.fill("input[name=pass]", "Weval@2026")
|
|
pg.click("button[type=submit]")
|
|
pg.wait_for_timeout(2000)
|
|
log("auth-login", True)
|
|
except Exception as e:
|
|
log("auth-login", False, str(e)[:100])
|
|
|
|
# Navigate to agents-archi
|
|
pg.goto(f"{BASE}/agents-archi.html", timeout=30000)
|
|
pg.wait_for_timeout(5000) # Wait for 3D to load
|
|
pg.screenshot(path=f"{SCREENSHOT_DIR}/agents-archi-01-load.png")
|
|
|
|
# Check Growth agent is visible
|
|
growth_visible = pg.evaluate("document.body.innerText.includes('Growth') || document.body.innerText.includes('growth') || document.body.innerText.includes('Agent')")
|
|
log("agents-archi-growth-visible", growth_visible)
|
|
pg.screenshot(path=f"{SCREENSHOT_DIR}/agents-archi-02-growth.png")
|
|
|
|
# Check 3D canvas loaded
|
|
has_canvas = pg.evaluate("!!document.querySelector('canvas')")
|
|
log("agents-archi-3d-canvas", has_canvas)
|
|
|
|
# Count visible agents
|
|
agent_count = pg.evaluate("document.querySelectorAll('.ag-card').length")
|
|
log("agents-archi-agent-count", agent_count > 20, f"{agent_count} agents")
|
|
|
|
# Interact: hover agents, wait for animations
|
|
pg.wait_for_timeout(3000)
|
|
pg.screenshot(path=f"{SCREENSHOT_DIR}/agents-archi-03-animated.png")
|
|
|
|
# Try clicking on Growth agent
|
|
try:
|
|
pg.evaluate("document.querySelectorAll('.ag-card').forEach(c => { if(c.textContent.includes('Growth')) c.click() })")
|
|
pg.wait_for_timeout(2000)
|
|
pg.screenshot(path=f"{SCREENSHOT_DIR}/agents-archi-04-growth-clicked.png")
|
|
log("agents-archi-growth-click", True)
|
|
except:
|
|
log("agents-archi-growth-click", False)
|
|
|
|
# Let 3D run for cinematic (10+ seconds)
|
|
for i in range(5):
|
|
pg.wait_for_timeout(2000)
|
|
pg.screenshot(path=f"{SCREENSHOT_DIR}/agents-archi-05-cinema-{i}.png")
|
|
|
|
ctx1.close()
|
|
|
|
# ═══ TEST 2: ENTERPRISE-MODEL ═══
|
|
print("\n" + "="*60)
|
|
print("TEST 2: ENTERPRISE-MODEL.HTML — Growth Department")
|
|
print("="*60)
|
|
|
|
ctx2 = browser.new_context(
|
|
viewport={"width":1920,"height":1080},
|
|
record_video_dir=VIDEO_DIR,
|
|
record_video_size={"width":1920,"height":1080},
|
|
ignore_https_errors=True
|
|
)
|
|
pg2 = ctx2.new_page()
|
|
|
|
# Auth
|
|
pg2.goto(f"{BASE}/login", timeout=15000)
|
|
pg2.wait_for_timeout(1000)
|
|
try:
|
|
pg2.fill("input[name=user]", "yacine")
|
|
pg2.fill("input[name=pass]", "Weval@2026")
|
|
pg2.click("button[type=submit]")
|
|
pg2.wait_for_timeout(2000)
|
|
except: pass
|
|
|
|
pg2.goto(f"{BASE}/enterprise-model.html", timeout=30000)
|
|
pg2.wait_for_timeout(5000)
|
|
pg2.screenshot(path=f"{SCREENSHOT_DIR}/enterprise-01-load.png")
|
|
|
|
growth_ent = pg2.evaluate("document.body.innerText.includes('Growth') || document.body.innerText.includes('growth') || document.body.innerText.includes('Agent')")
|
|
log("enterprise-growth-visible", growth_ent)
|
|
|
|
# Check 3D or canvas
|
|
has_3d = pg2.evaluate("!!document.querySelector('canvas')")
|
|
log("enterprise-3d-canvas", has_3d)
|
|
|
|
# Scroll and interact
|
|
pg2.evaluate("window.scrollTo(0, 500)")
|
|
pg2.wait_for_timeout(2000)
|
|
pg2.screenshot(path=f"{SCREENSHOT_DIR}/enterprise-02-scrolled.png")
|
|
|
|
# Let cinematic run
|
|
for i in range(5):
|
|
pg2.wait_for_timeout(2000)
|
|
pg2.screenshot(path=f"{SCREENSHOT_DIR}/enterprise-03-cinema-{i}.png")
|
|
|
|
ctx2.close()
|
|
|
|
# ═══ TEST 3: MEETING-ROOMS ═══
|
|
print("\n" + "="*60)
|
|
print("TEST 3: MEETING-ROOMS.HTML — Growth in Business Room")
|
|
print("="*60)
|
|
|
|
ctx3 = browser.new_context(
|
|
viewport={"width":1920,"height":1080},
|
|
record_video_dir=VIDEO_DIR,
|
|
record_video_size={"width":1920,"height":1080},
|
|
ignore_https_errors=True
|
|
)
|
|
pg3 = ctx3.new_page()
|
|
|
|
pg3.goto(f"{BASE}/login", timeout=15000)
|
|
pg3.wait_for_timeout(1000)
|
|
try:
|
|
pg3.fill("input[name=user]", "yacine")
|
|
pg3.fill("input[name=pass]", "Weval@2026")
|
|
pg3.click("button[type=submit]")
|
|
pg3.wait_for_timeout(2000)
|
|
except: pass
|
|
|
|
pg3.goto(f"{BASE}/wevia-meeting-rooms.html", timeout=30000)
|
|
pg3.wait_for_timeout(5000)
|
|
pg3.screenshot(path=f"{SCREENSHOT_DIR}/meeting-01-load.png")
|
|
|
|
growth_meet = pg3.evaluate("document.body.innerText.includes('Growth') || document.body.innerText.includes('growth') || document.body.innerText.includes('Agent')")
|
|
log("meeting-growth-visible", growth_meet)
|
|
|
|
# Navigate rooms
|
|
pg3.wait_for_timeout(3000)
|
|
pg3.screenshot(path=f"{SCREENSHOT_DIR}/meeting-02-rooms.png")
|
|
|
|
# Let cinematic run
|
|
for i in range(5):
|
|
pg3.wait_for_timeout(2000)
|
|
pg3.screenshot(path=f"{SCREENSHOT_DIR}/meeting-03-cinema-{i}.png")
|
|
|
|
ctx3.close()
|
|
|
|
# ═══ TEST 4: GROWTH-ENGINE ═══
|
|
print("\n" + "="*60)
|
|
print("TEST 4: GROWTH-ENGINE.HTML — Dashboard Full Test")
|
|
print("="*60)
|
|
|
|
ctx4 = browser.new_context(
|
|
viewport={"width":1920,"height":1080},
|
|
record_video_dir=VIDEO_DIR,
|
|
record_video_size={"width":1920,"height":1080},
|
|
ignore_https_errors=True
|
|
)
|
|
pg4 = ctx4.new_page()
|
|
|
|
pg4.goto(f"{BASE}/login", timeout=15000)
|
|
pg4.wait_for_timeout(1000)
|
|
try:
|
|
pg4.fill("input[name=user]", "yacine")
|
|
pg4.fill("input[name=pass]", "Weval@2026")
|
|
pg4.click("button[type=submit]")
|
|
pg4.wait_for_timeout(2000)
|
|
except: pass
|
|
|
|
pg4.goto(f"{BASE}/growth-engine.html", timeout=30000)
|
|
pg4.wait_for_timeout(3000)
|
|
pg4.screenshot(path=f"{SCREENSHOT_DIR}/growth-01-dashboard.png")
|
|
|
|
# Check KPIs visible
|
|
has_kpis = pg4.evaluate("document.querySelectorAll('.kpi').length")
|
|
log("growth-kpis", has_kpis >= 4, f"{has_kpis} KPIs")
|
|
|
|
# Check pipeline
|
|
has_pipeline = pg4.evaluate("document.querySelectorAll('.pipe-col').length")
|
|
log("growth-pipeline", has_pipeline >= 3, f"{has_pipeline} stages")
|
|
|
|
# Check chat
|
|
has_chat = pg4.evaluate("!!document.querySelector('.chat-box') || !!document.querySelector('.chat-panel')")
|
|
log("growth-chat", has_chat)
|
|
|
|
# Click tabs
|
|
tabs = ["opportunities", "pipeline", "actions", "assets", "intel"]
|
|
for tab in tabs:
|
|
try:
|
|
pg4.evaluate(f"document.querySelectorAll('.tab').forEach(t => {{ if(t.dataset && t.dataset.t === '{tab}') t.click(); else if(t.textContent.toLowerCase().includes('{tab[:4]}')) t.click() }})")
|
|
pg4.wait_for_timeout(1500)
|
|
pg4.screenshot(path=f"{SCREENSHOT_DIR}/growth-tab-{tab}.png")
|
|
log(f"growth-tab-{tab}", True)
|
|
except Exception as e:
|
|
log(f"growth-tab-{tab}", False, str(e)[:50])
|
|
|
|
# Test chat WEVIA Master
|
|
try:
|
|
chat_input = pg4.query_selector("#chatIn") or pg4.query_selector("#chatInput")
|
|
if chat_input:
|
|
chat_input.fill("growth engine status")
|
|
pg4.wait_for_timeout(500)
|
|
send_btn = pg4.query_selector(".chat-input button")
|
|
if send_btn:
|
|
send_btn.click()
|
|
pg4.wait_for_timeout(5000)
|
|
pg4.screenshot(path=f"{SCREENSHOT_DIR}/growth-chat-response.png")
|
|
log("growth-chat-send", True)
|
|
else:
|
|
log("growth-chat-send", False, "no send button")
|
|
else:
|
|
log("growth-chat-send", False, "no input found")
|
|
except Exception as e:
|
|
log("growth-chat-send", False, str(e)[:50])
|
|
|
|
# Test Scan button
|
|
try:
|
|
scan_btn = pg4.query_selector(".scan-btn")
|
|
if scan_btn:
|
|
scan_btn.click()
|
|
pg4.wait_for_timeout(8000)
|
|
pg4.screenshot(path=f"{SCREENSHOT_DIR}/growth-scan-result.png")
|
|
log("growth-scan-button", True)
|
|
else:
|
|
log("growth-scan-button", False, "no scan button")
|
|
except Exception as e:
|
|
log("growth-scan-button", False, str(e)[:50])
|
|
|
|
# Check action items clickable
|
|
checks = pg4.query_selector_all(".ck")
|
|
if checks and len(checks) > 0:
|
|
checks[0].click()
|
|
pg4.wait_for_timeout(500)
|
|
pg4.screenshot(path=f"{SCREENSHOT_DIR}/growth-action-checked.png")
|
|
log("growth-action-toggle", True, f"{len(checks)} actions")
|
|
else:
|
|
log("growth-action-toggle", False, "no action items")
|
|
|
|
ctx4.close()
|
|
browser.close()
|
|
|
|
# Save results
|
|
print("\n" + "="*60)
|
|
print("RÉSULTATS")
|
|
print("="*60)
|
|
passed = sum(1 for r in results if r['ok'])
|
|
total = len(results)
|
|
for r in results:
|
|
icon = "✅" if r['ok'] else "❌"
|
|
print(f" {icon} {r['test']:35} {r.get('detail','')}")
|
|
print(f"\nSCORE: {passed}/{total} ({round(passed/total*100)}%)")
|
|
|
|
# Save JSON
|
|
with open('/opt/weval-l99/growth-visual-test-results.json', 'w') as f:
|
|
json.dump({"results": results, "passed": passed, "total": total, "ts": time.strftime("%c")}, f, indent=2)
|
|
|
|
# List videos
|
|
print("\nVIDÉOS GÉNÉRÉES:")
|
|
for f in os.listdir(VIDEO_DIR):
|
|
size = os.path.getsize(os.path.join(VIDEO_DIR, f))
|
|
print(f" {f}: {round(size/1024)}KB")
|
|
|
|
print("\nSCREENSHOTS:")
|
|
for f in sorted(os.listdir(SCREENSHOT_DIR)):
|
|
if f.startswith(('agents-','enterprise-','meeting-','growth-')):
|
|
print(f" {f}")
|