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

72 lines
3.3 KiB
Python

#!/usr/bin/env python3
"""V125 smoke - verify 84 tiles + 14 filters render correctly"""
import asyncio, json, os
from playwright.async_api import async_playwright
OUT = "/var/www/html/api/blade-tasks/v125-widen-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'])
ctx = await browser.new_context(viewport={'width':1920,'height':1080}, record_video_dir=OUT)
page = await ctx.new_page()
errs = []
page.on('pageerror', lambda e: errs.append(str(e)))
await page.goto("https://weval-consulting.com/all-ia-hub.html?v=v125", wait_until='load', timeout=30000)
await page.wait_for_timeout(2000)
await page.click('[data-view="dashboards"]')
await page.wait_for_timeout(3500)
state = await page.evaluate("""() => ({
tiles: document.querySelectorAll('#dash-grid a').length,
pinned_tiles: document.querySelectorAll('#dash-pinned-section a').length,
filters_count: document.querySelectorAll('.dash-filter').length,
filter_labels: Array.from(document.querySelectorAll('.dash-filter')).map(f => f.textContent.trim()).slice(0,20),
stars: document.querySelectorAll('#dash-grid button[title*="Pin"]').length,
count_text: document.getElementById('dash-count')?.textContent
})""")
print(json.dumps(state, indent=2))
await page.screenshot(path=f"{OUT}/01-84-tiles.png", full_page=True)
# Test filter 'monitor' (new category)
monitor_btn = await page.query_selector('button[data-cat="monitor"]')
if monitor_btn:
await monitor_btn.click()
await page.wait_for_timeout(1000)
mon_state = await page.evaluate("() => ({tiles: document.querySelectorAll('#dash-grid a').length})")
print("Filter monitor:", json.dumps(mon_state))
await page.screenshot(path=f"{OUT}/02-filter-monitor.png", full_page=True)
# Test filter 'admin'
admin_btn = await page.query_selector('button[data-cat="admin"]')
if admin_btn:
await admin_btn.click()
await page.wait_for_timeout(1000)
admin_state = await page.evaluate("() => ({tiles: document.querySelectorAll('#dash-grid a').length})")
print("Filter admin:", json.dumps(admin_state))
await page.screenshot(path=f"{OUT}/03-filter-admin.png", full_page=True)
await ctx.close()
await browser.close()
verdict = 'OK' if (state['tiles'] >= 80 and
state['filters_count'] >= 14 and
state['stars'] == state['tiles'] and
not errs) else 'PARTIAL'
report = {
'v125': 'widen-84-tiles-14-cats',
'tiles_total': state['tiles'],
'filters_total': state['filters_count'],
'all_tiles_have_star': state['stars'] == state['tiles'],
'count_text': state['count_text'],
'js_errors': errs,
'VERDICT': verdict
}
with open(f"{OUT}/proof.json",'w') as f: json.dump(report, f, indent=2)
print("=== VERDICT:", verdict)
asyncio.run(main())