75 lines
3.2 KiB
Python
75 lines
3.2 KiB
Python
#!/usr/bin/env python3
|
|
"""V122 smoke test - verify no regression + visual screenshot"""
|
|
import asyncio, json, os
|
|
from playwright.async_api import async_playwright
|
|
|
|
OUT = "/var/www/html/api/blade-tasks/v122-polish-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)))
|
|
page.on('console', lambda m: errs.append(f"[{m.type}]{m.text}") if m.type == 'error' else None)
|
|
|
|
await page.goto("https://weval-consulting.com/all-ia-hub.html?v=v122", wait_until='load', timeout=30000)
|
|
await page.wait_for_timeout(2000)
|
|
|
|
# Tab 1: chat (default on)
|
|
s1 = await page.evaluate("() => ({chat_on: document.getElementById('v-chat')?.classList.contains('on')})")
|
|
print("Chat tab:", s1)
|
|
|
|
# Tab 2: capabilities
|
|
await page.click('[data-view="capabilities"]')
|
|
await page.wait_for_timeout(1000)
|
|
s2 = await page.evaluate("() => ({caps_on: document.getElementById('v-caps')?.classList.contains('on'), caps_count: document.querySelectorAll('.cap').length})")
|
|
print("Caps tab:", s2)
|
|
|
|
# Tab 3: dashboards
|
|
await page.click('[data-view="dashboards"]')
|
|
await page.wait_for_timeout(3500)
|
|
s3 = await page.evaluate("""() => ({
|
|
dash_on: document.getElementById('v-dashboards')?.classList.contains('on'),
|
|
tiles: document.querySelectorAll('#dash-grid a').length,
|
|
has_sticky: getComputedStyle(document.getElementById('dash-filters')).position === 'sticky',
|
|
has_class: document.querySelectorAll('.dash-tile').length
|
|
})""")
|
|
print("Dashboards tab:", s3)
|
|
await page.screenshot(path=f"{OUT}/01-dashboards-polish.png", full_page=True)
|
|
|
|
# Hover on first tile
|
|
tile = await page.query_selector('.dash-tile')
|
|
if tile:
|
|
await tile.hover()
|
|
await page.wait_for_timeout(800)
|
|
await page.screenshot(path=f"{OUT}/02-hover.png")
|
|
|
|
# Scroll to test sticky
|
|
await page.evaluate("document.querySelector('#v-dashboards').scrollIntoView({block:'start'}); window.scrollBy(0, 400);")
|
|
await page.wait_for_timeout(500)
|
|
await page.screenshot(path=f"{OUT}/03-scrolled.png")
|
|
|
|
await ctx.close()
|
|
await browser.close()
|
|
|
|
verdict = 'OK' if (s3['tiles'] > 60 and s3['has_class'] > 60 and not errs) else 'PARTIAL'
|
|
report = {
|
|
'v122': 'polish-smoke',
|
|
'chat_on': s1['chat_on'],
|
|
'caps_count': s2['caps_count'],
|
|
'dashboards_tiles': s3['tiles'],
|
|
'has_sticky_filters': s3['has_sticky'],
|
|
'has_dash_tile_class': s3['has_class'],
|
|
'js_errors': errs[:3],
|
|
'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())
|