74 lines
3.0 KiB
Python
74 lines
3.0 KiB
Python
#!/usr/bin/env python3
|
|
"""V130 E2E - Verify breadcrumb xnav visible + 3 links clickable"""
|
|
import asyncio, json, os
|
|
from playwright.async_api import async_playwright
|
|
|
|
OUT = "/var/www/html/api/blade-tasks/v130-breadcrumb-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=v130", wait_until='load', timeout=30000)
|
|
await page.wait_for_timeout(2000)
|
|
|
|
state = await page.evaluate("""() => {
|
|
const xnav = document.getElementById('v130-xnav');
|
|
const links = xnav ? Array.from(xnav.querySelectorAll('a')).map(a => ({
|
|
text: a.textContent.trim(),
|
|
href: a.getAttribute('href'),
|
|
title: a.getAttribute('title')
|
|
})) : [];
|
|
return {
|
|
xnav_exists: !!xnav,
|
|
xnav_visible: xnav ? getComputedStyle(xnav).display !== 'none' : false,
|
|
links_count: links.length,
|
|
links: links
|
|
};
|
|
}""")
|
|
print("V130 xnav state:", json.dumps(state, indent=2))
|
|
await page.screenshot(path=f"{OUT}/01-breadcrumb-top.png", clip={'x':0,'y':0,'width':1920,'height':120})
|
|
await page.screenshot(path=f"{OUT}/02-full-page.png", full_page=True)
|
|
|
|
# Test click: Arena link should navigate
|
|
arena_link = await page.query_selector('#v130-xnav a[href="/weval-arena.html"]')
|
|
if arena_link:
|
|
href = await arena_link.get_attribute('href')
|
|
print(f"Arena link href: {href}")
|
|
|
|
await ctx.close()
|
|
await browser.close()
|
|
|
|
expected_hrefs = ['/weval-technology-platform.html', '/weval-arena.html', '/wevia-master.html']
|
|
actual_hrefs = [l['href'] for l in state['links']]
|
|
all_expected_present = all(e in actual_hrefs for e in expected_hrefs)
|
|
|
|
verdict = 'OK' if (
|
|
state['xnav_exists'] and
|
|
state['xnav_visible'] and
|
|
state['links_count'] == 3 and
|
|
all_expected_present and
|
|
not errs
|
|
) else 'PARTIAL'
|
|
|
|
report = {
|
|
'v130': 'breadcrumb-xnav',
|
|
'xnav_exists': state['xnav_exists'],
|
|
'xnav_visible': state['xnav_visible'],
|
|
'links_count': state['links_count'],
|
|
'links_labels': [l['text'] for l in state['links']],
|
|
'all_expected_hrefs_present': all_expected_present,
|
|
'js_errors': errs,
|
|
'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())
|