102 lines
3.9 KiB
Python
102 lines
3.9 KiB
Python
"""Validate WTP as POINT D'ENTRÉE TOTAL · nav 5 new views"""
|
|
import time, json
|
|
from pathlib import Path
|
|
from playwright.sync_api import sync_playwright
|
|
TS = time.strftime("%Y%m%d-%H%M%S")
|
|
OUT = Path(f"/var/www/html/test-report/wtp-enriched-{TS}")
|
|
OUT.mkdir(parents=True, exist_ok=True)
|
|
results = {"ts": TS, "views": []}
|
|
|
|
try:
|
|
with sync_playwright() as p:
|
|
browser = p.chromium.launch(headless=True, args=["--no-sandbox"])
|
|
ctx = browser.new_context(
|
|
viewport={"width":1600,"height":1200},
|
|
ignore_https_errors=True,
|
|
record_video_dir=str(OUT),
|
|
record_video_size={"width":1600,"height":1200}
|
|
)
|
|
page = ctx.new_page()
|
|
page.goto(f"https://weval-consulting.com/weval-technology-platform.html?e={TS}", wait_until="networkidle", timeout=25000)
|
|
time.sleep(6)
|
|
page.screenshot(path=str(OUT/"01-home.png"), full_page=True)
|
|
|
|
# Check sidebar has new sections
|
|
new_items = page.evaluate("""() => [...document.querySelectorAll('.wtp-nav-item')].map(i => ({
|
|
mod: i.dataset.mod,
|
|
label: i.querySelector('span:nth-child(2)')?.textContent,
|
|
count: i.querySelector('.wtp-nav-count')?.textContent
|
|
}))""")
|
|
results["sidebar_items"] = new_items
|
|
print(f" ✓ sidebar items: {len(new_items)}")
|
|
for i in new_items[-6:]:
|
|
print(f" · {i}")
|
|
|
|
# Click Infrastructure
|
|
try:
|
|
page.evaluate("navigateTo('infra')")
|
|
time.sleep(3)
|
|
page.screenshot(path=str(OUT/"02-infra.png"), full_page=True)
|
|
results["views"].append({"view":"infra","ok":True})
|
|
print(f" ✓ infra view rendered")
|
|
except Exception as e:
|
|
print(f" ✗ infra: {e}")
|
|
|
|
# All Pages
|
|
try:
|
|
page.evaluate("navigateTo('all_pages')")
|
|
time.sleep(3)
|
|
page.screenshot(path=str(OUT/"03-all-pages.png"), full_page=True)
|
|
# Test search
|
|
page.fill("#pg-search", "ethica")
|
|
time.sleep(2)
|
|
page.screenshot(path=str(OUT/"04-pages-search-ethica.png"), full_page=False)
|
|
results["views"].append({"view":"all_pages","ok":True})
|
|
print(f" ✓ all_pages view rendered + search works")
|
|
except Exception as e:
|
|
print(f" ✗ all_pages: {e}")
|
|
|
|
# All APIs
|
|
try:
|
|
page.evaluate("navigateTo('all_apis')")
|
|
time.sleep(3)
|
|
page.screenshot(path=str(OUT/"05-all-apis.png"), full_page=True)
|
|
results["views"].append({"view":"all_apis","ok":True})
|
|
print(f" ✓ all_apis view rendered")
|
|
except Exception as e:
|
|
print(f" ✗ all_apis: {e}")
|
|
|
|
# Multiagent
|
|
try:
|
|
page.evaluate("navigateTo('multiagent')")
|
|
time.sleep(3)
|
|
page.screenshot(path=str(OUT/"06-multiagent.png"), full_page=True)
|
|
results["views"].append({"view":"multiagent","ok":True})
|
|
print(f" ✓ multiagent view rendered")
|
|
except Exception as e:
|
|
print(f" ✗ multiagent: {e}")
|
|
|
|
# Truth
|
|
try:
|
|
page.evaluate("navigateTo('truth')")
|
|
time.sleep(3)
|
|
page.screenshot(path=str(OUT/"07-truth.png"), full_page=True)
|
|
results["views"].append({"view":"truth","ok":True})
|
|
print(f" ✓ truth view rendered")
|
|
except Exception as e:
|
|
print(f" ✗ truth: {e}")
|
|
|
|
ctx.close()
|
|
browser.close()
|
|
|
|
videos = list(OUT.glob("*.webm"))
|
|
results["video"] = videos[0].name if videos else None
|
|
pngs = list(OUT.glob("*.png"))
|
|
results["screenshots"] = len(pngs)
|
|
print(f"\n ✓ screenshots={len(pngs)} · video={results['video']}")
|
|
|
|
with open(OUT/"results.json","w") as f:
|
|
json.dump(results, f, indent=2, default=str)
|
|
except Exception as e:
|
|
print(f"err: {e}")
|