88 lines
4.3 KiB
Python
88 lines
4.3 KiB
Python
#!/usr/bin/env python3
|
||
"""V143 E2E - WePredict Cockpit renders 15 depts × 4 levels, mirofish link works, footer live"""
|
||
import asyncio, json, os
|
||
from playwright.async_api import async_playwright
|
||
|
||
OUT = "/var/www/html/api/blade-tasks/v143-wepredict-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})
|
||
page = await ctx.new_page()
|
||
errs = []
|
||
page.on('pageerror', lambda e: errs.append(str(e)))
|
||
|
||
await page.goto("https://weval-consulting.com/wepredict.html", wait_until='load', timeout=30000)
|
||
await page.wait_for_timeout(3000)
|
||
|
||
state = await page.evaluate("""() => ({
|
||
title: document.title,
|
||
h1_present: !!document.querySelector('.hero h1'),
|
||
levels_count: document.querySelectorAll('.level').length,
|
||
depts_count: document.querySelectorAll('.dept').length,
|
||
rows_count: document.querySelectorAll('.dept-row').length,
|
||
mirofish_cta: document.querySelector('a[href*="mirofish"]')?.href,
|
||
xnav_links: document.querySelectorAll('#xnav a').length,
|
||
footer_score: document.getElementById('f-score')?.textContent,
|
||
footer_l99: document.getElementById('f-l99')?.textContent,
|
||
footer_docker: document.getElementById('f-docker')?.textContent,
|
||
honest_badges_count: document.querySelectorAll('.honest').length,
|
||
live_badges: document.querySelectorAll('.honest.live').length,
|
||
trend_badges: document.querySelectorAll('.honest.trend').length,
|
||
forecast_badges: document.querySelectorAll('.honest.forecast').length,
|
||
dept_names: Array.from(document.querySelectorAll('.dept h3')).map(e => e.textContent.trim())
|
||
})""")
|
||
|
||
print("V143 state:", json.dumps(state, indent=2, ensure_ascii=False))
|
||
await page.screenshot(path=f"{OUT}/01-hero.png", full_page=False)
|
||
await page.screenshot(path=f"{OUT}/02-full.png", full_page=True)
|
||
|
||
# Verify mirofish still intact
|
||
await page.goto("https://mirofish.weval-consulting.com/", wait_until='load', timeout=20000)
|
||
await page.wait_for_timeout(2000)
|
||
mirofish_title = await page.title()
|
||
|
||
await ctx.close()
|
||
await browser.close()
|
||
|
||
verdict = 'OK' if (
|
||
state['depts_count'] == 15 and
|
||
state['rows_count'] == 60 and # 15 × 4
|
||
state['levels_count'] == 4 and
|
||
state['xnav_links'] >= 6 and # HEXA
|
||
'mirofish' in (state['mirofish_cta'] or '') and
|
||
state['footer_score'] and '%' in state['footer_score'] and
|
||
state['footer_l99'] and 'L99' in state['footer_l99'] and
|
||
state['honest_badges_count'] >= 60 and
|
||
'WePredict' in mirofish_title and
|
||
not errs
|
||
) else 'PARTIAL'
|
||
|
||
report = {
|
||
'v143': 'wepredict-cockpit',
|
||
'depts_exactly_15': state['depts_count'] == 15,
|
||
'rows_exactly_60': state['rows_count'] == 60,
|
||
'levels_4': state['levels_count'] == 4,
|
||
'xnav_hexa_pivot': state['xnav_links'] >= 6,
|
||
'mirofish_cta_linked': 'mirofish.weval-consulting.com' in (state['mirofish_cta'] or ''),
|
||
'footer_ecosystem_live': bool(state['footer_score'] and '%' in state['footer_score']),
|
||
'footer_l99_rendered': bool(state['footer_l99'] and 'L99' in state['footer_l99']),
|
||
'honest_badges_all_60': state['honest_badges_count'] >= 60,
|
||
'live_badges': state['live_badges'],
|
||
'trend_badges': state['trend_badges'],
|
||
'forecast_badges': state['forecast_badges'],
|
||
'dept_names_sample': state['dept_names'][:5],
|
||
'dept_names_count': len(state['dept_names']),
|
||
'mirofish_still_200_intact': 'WePredict' in mirofish_title,
|
||
'mirofish_title': mirofish_title,
|
||
'js_errors': errs,
|
||
'VERDICT': verdict
|
||
}
|
||
with open(f"{OUT}/proof.json",'w') as f: json.dump(report, f, indent=2, ensure_ascii=False)
|
||
print("=== VERDICT:", verdict)
|
||
print(json.dumps(report, indent=2, ensure_ascii=False))
|
||
|
||
asyncio.run(main())
|