49 lines
No EOL
2.4 KiB
Python
49 lines
No EOL
2.4 KiB
Python
import asyncio, json
|
|
from playwright.async_api import async_playwright
|
|
|
|
PATHS = [("/", "v1"), ("/v2/", "v2"), ("/v3/", "v3"), ("/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"])
|
|
out = {}
|
|
for path, label in PATHS:
|
|
pg = await b.new_page(viewport={"width": 1600, "height": 1100})
|
|
errs = []
|
|
pg.on("pageerror", lambda e: errs.append(f"PAGEERR {e}"))
|
|
pg.on("console", lambda m: errs.append(f"C {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(3000)
|
|
|
|
tabs = {}
|
|
for t in TABS:
|
|
await pg.evaluate(f"() => document.querySelector('#tabs button[data-view=\"{t}\"]')?.click()")
|
|
await pg.wait_for_timeout(2200)
|
|
tabs[t] = await pg.evaluate(f"""() => {{
|
|
const v = document.getElementById('view-{t}');
|
|
const txt = v ? v.innerText.replace(/\\s+/g,' ').trim() : '';
|
|
return {{on: v?.classList.contains('active'), len: txt.length}};
|
|
}}""")
|
|
|
|
base = await pg.evaluate("""() => ({
|
|
tabs: document.querySelectorAll('#tabs button').length,
|
|
rtl: document.documentElement.dir === 'rtl',
|
|
vazir: getComputedStyle(document.body).fontFamily.includes('Vazirmatn'),
|
|
chips: document.querySelectorAll('.top-meta a.date-chip').length,
|
|
ovf: document.documentElement.scrollWidth - document.documentElement.clientWidth
|
|
})""")
|
|
|
|
# team tab must have real content now
|
|
team = await pg.evaluate("""() => ({
|
|
cards: document.querySelectorAll('#teamCards .card').length,
|
|
meta: document.getElementById('teamMeta')?.innerText.slice(0,70)
|
|
})""")
|
|
out[label] = {"base": base, "team": team, "minTabLen": min(v["len"] for v in tabs.values()),
|
|
"allOn": all(v["on"] for v in tabs.values()), "errs": errs[:4]}
|
|
await pg.close()
|
|
|
|
print(json.dumps(out, ensure_ascii=False, indent=2))
|
|
await b.close()
|
|
|
|
asyncio.run(main()) |