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

80 lines
3.7 KiB
Python

#!/usr/bin/env python3
"""V111 E2E - Test Blade Task push from Hub Capabilities tab"""
import asyncio, json, os
from playwright.async_api import async_playwright
OUT = "/var/www/html/api/blade-tasks/v111-blade-actions-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()
# Load Hub + go to Capabilities tab
await page.goto("https://weval-consulting.com/all-ia-hub.html?v=v111", wait_until='load', timeout=30000)
await page.wait_for_timeout(2000)
await page.click('[data-view="capabilities"]')
await page.wait_for_timeout(3000) # Wait for blade stats to load
# Check blade section exists
blade_check = await page.evaluate("""() => ({
has_blade_card: !!document.querySelector('.cap h3:has-text("Blade Tasks Queue")') ||
Array.from(document.querySelectorAll('.cap h3')).some(h => h.textContent.includes('Blade Tasks')),
blade_pending: document.getElementById('blade-pending')?.textContent,
blade_done: document.getElementById('blade-done')?.textContent,
buttons: Array.from(document.querySelectorAll('[onclick*="pushBladeTask"]')).map(b => b.textContent.trim())
})""")
print("Blade section:", json.dumps(blade_check, indent=2))
await page.screenshot(path=f"{OUT}/01-blade-card.png", full_page=True)
# Test push: click Office Create button
office_btn = await page.query_selector('button[onclick*="office_create"]')
if office_btn:
await office_btn.click()
await page.wait_for_timeout(3000)
# Check log for success
log_content = await page.evaluate("""() => ({
log_visible: document.getElementById('blade-log')?.style?.display !== 'none',
log_text: document.getElementById('blade-log')?.textContent?.trim().substring(0, 500),
new_pending: document.getElementById('blade-pending')?.textContent
})""")
print("\nAfter Office Create push:", json.dumps(log_content, indent=2))
await page.screenshot(path=f"{OUT}/02-office-pushed.png", full_page=True)
# Push another
ds_btn = await page.query_selector('button[onclick*="deepseek_renew"]')
if ds_btn:
await ds_btn.click()
await page.wait_for_timeout(3000)
log_content2 = await page.evaluate("""() => ({
log_text: document.getElementById('blade-log')?.textContent?.trim().substring(0, 600)
})""")
print("\nAfter DeepSeek Renew push:", json.dumps(log_content2, indent=2))
await page.screenshot(path=f"{OUT}/03-deepseek-pushed.png", full_page=True)
await context.close()
await browser.close()
# Verdicts
tasks_created = ('Task created' in (log_content.get('log_text') or '')) and ('Task created' in (log_content2.get('log_text') or ''))
report = {
'v111': 'blade-task-push-from-hub',
'blade_section_visible': blade_check['has_blade_card'],
'blade_buttons_count': len(blade_check.get('buttons',[])),
'tasks_created_ok': tasks_created,
'pending_incremented': log_content.get('new_pending') != '...',
'VERDICT': 'WIRED' if tasks_created else 'NEED_DEBUG'
}
with open(f"{OUT}/proof.json",'w') as f:
json.dump(report, f, indent=2)
print("\n=== VERDICT:", report['VERDICT'])
asyncio.run(main())