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

79 lines
3.4 KiB
Python

#!/usr/bin/env python3
"""V121 E2E - Test Cmd+K shortcut + Escape clear + stabilization"""
import asyncio, json, os
from playwright.async_api import async_playwright
OUT = "/var/www/html/api/blade-tasks/v121-keyboard-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=v121", wait_until='load', timeout=30000)
await page.wait_for_timeout(2000)
await page.click('[data-view="dashboards"]')
await page.wait_for_timeout(3000)
# Initial: not focused
before = await page.evaluate("() => ({focused: document.activeElement?.id || 'none'})")
print("Before Cmd+K:", json.dumps(before))
# Press Cmd+K (Meta+K)
await page.keyboard.press('Meta+k')
await page.wait_for_timeout(500)
after_k = await page.evaluate("() => ({focused: document.activeElement?.id || 'none'})")
print("After Meta+K:", json.dumps(after_k))
# Type "ethica"
await page.keyboard.type('ethica')
await page.wait_for_timeout(500)
typed = await page.evaluate("""() => ({
value: document.getElementById('dash-search')?.value,
tiles: document.querySelectorAll('#dash-grid a').length
})""")
print("After typing 'ethica':", json.dumps(typed))
await page.screenshot(path=f"{OUT}/01-search-via-cmdk.png", full_page=True)
# Press Escape
await page.keyboard.press('Escape')
await page.wait_for_timeout(500)
after_esc = await page.evaluate("""() => ({
value: document.getElementById('dash-search')?.value,
tiles: document.querySelectorAll('#dash-grid a').length
})""")
print("After Escape:", json.dumps(after_esc))
await page.screenshot(path=f"{OUT}/02-after-escape.png", full_page=True)
# Try Ctrl+K
await page.keyboard.press('Control+k')
await page.wait_for_timeout(300)
after_ctrl = await page.evaluate("() => ({focused: document.activeElement?.id || 'none'})")
print("After Ctrl+K:", json.dumps(after_ctrl))
await context.close()
await browser.close()
verdict = 'WIRED' if (after_k['focused']=='dash-search' and
typed.get('tiles',99) == 2 and
after_esc.get('value') == '' and
after_esc.get('tiles',0) > 60 and
after_ctrl['focused']=='dash-search') else 'PARTIAL'
report = {
'v121': 'keyboard-shortcuts',
'cmd_k_focuses_search': after_k['focused']=='dash-search',
'typing_filters': typed.get('tiles') == 2,
'escape_clears': after_esc.get('value') == '' and after_esc.get('tiles',0) > 60,
'ctrl_k_also_works': after_ctrl['focused']=='dash-search',
'VERDICT': verdict
}
with open(f"{OUT}/proof.json",'w') as f: json.dump(report, f, indent=2)
print("=== VERDICT:", verdict)
print(json.dumps(report, indent=2))
asyncio.run(main())