Files
weval-l99/v112_proof.py
2026-04-24 04:38:58 +02:00

88 lines
3.4 KiB
Python

#!/usr/bin/env python3
"""V112 E2E - Test blade task push with fixed JS"""
import asyncio, json, os
from playwright.async_api import async_playwright
OUT = "/var/www/html/api/blade-tasks/v112-blade-fix-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()
# Capture console messages
console_msgs = []
page.on('console', lambda m: console_msgs.append(f"[{m.type}] {m.text}"))
await page.goto("https://weval-consulting.com/all-ia-hub.html?v=v112", wait_until='load', timeout=30000)
await page.wait_for_timeout(2000)
await page.click('[data-view="capabilities"]')
await page.wait_for_timeout(3000)
# Initial stats
initial = await page.evaluate("""() => ({
pending: document.getElementById('blade-pending')?.textContent,
done: document.getElementById('blade-done')?.textContent
})""")
print("Initial stats:", json.dumps(initial))
# Click Office Create
office_btn = await page.query_selector('button[onclick*="office_create"]')
if office_btn:
await office_btn.click()
await page.wait_for_timeout(4000)
after1 = await page.evaluate("""() => {
const log = document.getElementById('blade-log');
return {
pending: document.getElementById('blade-pending')?.textContent,
log_visible: log ? log.style.display : 'none',
log_html: log ? log.innerHTML.substring(0, 500) : ''
};
}""")
print("\nAfter Office Create:", json.dumps(after1, indent=2))
await page.screenshot(path=f"{OUT}/01-office-clicked.png", full_page=True)
# Click DeepSeek
ds_btn = await page.query_selector('button[onclick*="deepseek_renew"]')
if ds_btn:
await ds_btn.click()
await page.wait_for_timeout(4000)
after2 = await page.evaluate("""() => {
const log = document.getElementById('blade-log');
return {
pending: document.getElementById('blade-pending')?.textContent,
log_html: log ? log.innerHTML.substring(0, 800) : ''
};
}""")
print("\nAfter DeepSeek:", json.dumps(after2, indent=2))
await page.screenshot(path=f"{OUT}/02-deepseek-clicked.png", full_page=True)
print("\nConsole messages:")
for m in console_msgs[-15:]:
print(f" {m}")
await context.close()
await browser.close()
tasks_ok = 'Task created' in (after1.get('log_html','') + after2.get('log_html',''))
report = {
'v112': 'blade-fix-urlencoded',
'initial': initial,
'office_result': after1,
'deepseek_result': after2,
'console_msgs_count': len(console_msgs),
'VERDICT': 'WIRED' if tasks_ok else 'STILL_BROKEN'
}
with open(f"{OUT}/proof.json",'w') as f:
json.dump(report, f, indent=2)
print("\n=== VERDICT:", report['VERDICT'])
asyncio.run(main())