102 lines
4.3 KiB
Python
Executable File
102 lines
4.3 KiB
Python
Executable File
#!/usr/bin/env python3
|
|
from playwright.sync_api import sync_playwright
|
|
import time, json, os
|
|
|
|
results = {'pages':[], 'sso':[], 'apis':[], 'scenarios':[], 'screenshots':[]}
|
|
|
|
with sync_playwright() as p:
|
|
b = p.chromium.launch(headless=True)
|
|
ctx = b.new_context(record_video_dir='/tmp/pw-e2e/', viewport={'width':1920,'height':1080})
|
|
pg = ctx.new_page()
|
|
errs = []
|
|
pg.on('pageerror', lambda e: errs.append(str(e)[:50]))
|
|
|
|
# === SCENARIO 1: ALL PAGES LOAD ===
|
|
pages = [
|
|
('Homepage', '/'),
|
|
('L99 Brain', '/l99-brain.html'),
|
|
('WEVIA Master', '/wevia-master.html'),
|
|
('Sovereign', '/sovereign-claude.html'),
|
|
('Claw Chat', '/claw-chat.html'),
|
|
('OpenClaw', '/openclaw.html'),
|
|
('Wevcode', '/wevcode.html'),
|
|
('L99 SaaS', '/l99-saas.html'),
|
|
('Enterprise', '/enterprise-model.html'),
|
|
('Meetings', '/wevia-meeting-rooms.html'),
|
|
('Console', '/wevia-console.html'),
|
|
('Cortex', '/wevia-cortex.html'),
|
|
('Monitor', '/realtime-monitor-v3.html'),
|
|
('AI Bench', '/ai-benchmark.html'),
|
|
('WEVIA Life', '/products/wevia-life.html'),
|
|
('WEVIA App', '/products/wevialife-app.html'),
|
|
('L99 Fullscreen', '/l99-fullscreen.html'),
|
|
('Admin', '/admin.html'),
|
|
]
|
|
|
|
for name, path in pages:
|
|
try:
|
|
errs.clear()
|
|
pg.goto('https://weval-consulting.com'+path, wait_until='domcontentloaded', timeout=10000)
|
|
time.sleep(1)
|
|
code = pg.evaluate('() => document.readyState')
|
|
title = pg.title()[:40]
|
|
je = len(errs)
|
|
# Screenshot
|
|
ss_path = f'/tmp/pw-e2e/ss-{name.lower().replace(" ","-")}.png'
|
|
pg.screenshot(path=ss_path)
|
|
results['pages'].append({'name':name,'path':path,'status':'PASS','title':title,'js_errors':je})
|
|
results['screenshots'].append(ss_path)
|
|
except Exception as e:
|
|
results['pages'].append({'name':name,'path':path,'status':'FAIL','error':str(e)[:60]})
|
|
|
|
# === SCENARIO 2: L99 BRAIN CLICK TEST ===
|
|
pg.goto('https://weval-consulting.com/l99-brain.html', wait_until='networkidle', timeout=15000)
|
|
time.sleep(1)
|
|
btns = pg.locator('.sug').count()
|
|
pg.locator('.sug').first.click()
|
|
time.sleep(8)
|
|
msgs = pg.locator('.msg').count()
|
|
results['scenarios'].append({'name':'L99 Brain Click','btns':btns,'msgs':msgs,'status':'PASS' if msgs>0 else 'FAIL'})
|
|
pg.screenshot(path='/tmp/pw-e2e/ss-l99-click.png')
|
|
|
|
# === SCENARIO 3: ENTERPRISE AGENTS ===
|
|
pg.goto('https://weval-consulting.com/enterprise-model.html', wait_until='domcontentloaded', timeout=15000)
|
|
time.sleep(3)
|
|
agents = pg.evaluate('() => typeof AG !== "undefined" ? AG.length : 0')
|
|
depts = pg.evaluate('() => typeof DP !== "undefined" ? DP.length : 0')
|
|
results['scenarios'].append({'name':'Enterprise Model','agents':agents,'depts':depts,'status':'PASS' if agents>100 else 'FAIL'})
|
|
pg.screenshot(path='/tmp/pw-e2e/ss-enterprise.png')
|
|
|
|
# === SCENARIO 4: SSO REDIRECT CHECK ===
|
|
for sp in ['/ops-center.html', '/security-dashboard.html']:
|
|
pg.goto('https://weval-consulting.com'+sp, wait_until='domcontentloaded', timeout=10000)
|
|
time.sleep(1)
|
|
url = pg.url
|
|
is_sso = 'auth' in url or 'login' in url or 'outpost' in url
|
|
results['sso'].append({'page':sp,'redirected':is_sso,'final_url':url[:60],'status':'PASS'})
|
|
|
|
ctx.close()
|
|
b.close()
|
|
|
|
# Summary
|
|
pass_count = sum(1 for p in results['pages'] if p.get('status')=='PASS')
|
|
total = len(results['pages'])
|
|
scen_pass = sum(1 for s in results['scenarios'] if s.get('status')=='PASS')
|
|
|
|
print(f"PAGES: {pass_count}/{total} PASS")
|
|
print(f"SCENARIOS: {scen_pass}/{len(results['scenarios'])} PASS")
|
|
print(f"SSO: {len(results['sso'])}/{len(results['sso'])} checked")
|
|
print(f"SCREENSHOTS: {len(results['screenshots'])}")
|
|
|
|
for p in results['pages']:
|
|
s = '✅' if p['status']=='PASS' else '❌'
|
|
print(f" {s} {p['name']}: {p.get('title','')[:30]} {p.get('js_errors',0)}err")
|
|
|
|
for s in results['scenarios']:
|
|
print(f" {'✅' if s['status']=='PASS' else '❌'} {s['name']}: {json.dumps({k:v for k,v in s.items() if k!='name' and k!='status'})}")
|
|
|
|
# Save JSON
|
|
with open('/var/www/html/api/l99-e2e-report.json','w') as f:
|
|
json.dump(results, f, indent=2)
|
|
print("\nReport: /api/l99-e2e-report.json")
|