59 lines
No EOL
2.7 KiB
Python
59 lines
No EOL
2.7 KiB
Python
import asyncio, json
|
|
from playwright.async_api import async_playwright
|
|
|
|
PATHS = [("/", "v1 عملیاتی"), ("/v2/", "v2 BI"), ("/v3/", "v3 Apex"), ("/new/", "new بازطراحی")]
|
|
TABS = ["dashboard", "calendar", "weekly", "monthly", "roadmap", "tasks", "team", "remind", "sync"]
|
|
|
|
async def main():
|
|
async with async_playwright() as p:
|
|
b = await p.chromium.launch(args=["--no-sandbox"])
|
|
report = {}
|
|
for path, label in PATHS:
|
|
pg = await b.new_page(viewport={"width": 1600, "height": 1100}, device_scale_factor=1)
|
|
errs = []
|
|
pg.on("pageerror", lambda e: errs.append(f"PAGEERR {e}"))
|
|
pg.on("console", lambda m: errs.append(f"CONSOLE {m.text}") if m.type == "error" else None)
|
|
await pg.goto(f"https://parastoo.zebellkhan.com{path}", wait_until="networkidle", timeout=90000)
|
|
await pg.wait_for_timeout(3500)
|
|
|
|
base = await pg.evaluate("""() => ({
|
|
title: document.title,
|
|
rtl: document.documentElement.dir,
|
|
tabs: document.querySelectorAll('#tabs button').length,
|
|
font: getComputedStyle(document.body).fontFamily.includes('Vazirmatn'),
|
|
navChips: document.querySelectorAll('.top-meta a.date-chip').length,
|
|
latinDigits: (() => {
|
|
const t = document.querySelector('.app')?.innerText || '';
|
|
return (t.match(/[0-9]/g) || []).length;
|
|
})(),
|
|
overflow: document.documentElement.scrollWidth - document.documentElement.clientWidth,
|
|
plotly: typeof Plotly !== 'undefined'
|
|
})""")
|
|
|
|
# walk every tab, count content + errors
|
|
tabstats = {}
|
|
for t in TABS:
|
|
ok = await pg.evaluate(f"""() => {{
|
|
const b = document.querySelector('#tabs button[data-view="{t}"]');
|
|
if (!b) return false;
|
|
b.click();
|
|
return true;
|
|
}}""")
|
|
await pg.wait_for_timeout(1300)
|
|
tabstats[t] = await pg.evaluate(f"""() => {{
|
|
const v = document.getElementById('view-{t}');
|
|
return {{
|
|
exists: !!v,
|
|
active: v ? v.classList.contains('active') : false,
|
|
chars: v ? v.innerText.replace(/\\s+/g,' ').trim().length : 0,
|
|
overflow: document.documentElement.scrollWidth - document.documentElement.clientWidth
|
|
}};
|
|
}}""")
|
|
|
|
report[label] = {"base": base, "tabs": tabstats, "errors": errs[:5]}
|
|
await pg.close()
|
|
|
|
print(json.dumps(report, ensure_ascii=False, indent=2))
|
|
await b.close()
|
|
|
|
asyncio.run(main()) |