parastoo-dashboards/parastoo_dashboard/shots.py

31 lines
No EOL
1.2 KiB
Python

import asyncio, os
from playwright.async_api import async_playwright
OUT = "/workspace/parastoo_dashboard/audit"
os.makedirs(OUT, exist_ok=True)
SHOTS = [
("/", "dashboard", "final_v1_dashboard"),
("/", "team", "final_v1_team"),
("/", "remind", "final_v1_remind"),
("/", "sync", "final_v1_sync"),
("/v2/", "monthly", "final_v2_monthly"),
("/v3/", "roadmap", "final_v3_roadmap"),
("/new/", "tasks", "final_new_tasks"),
]
async def main():
async with async_playwright() as p:
b = await p.chromium.launch(args=["--no-sandbox"])
for path, tab, name in SHOTS:
pg = await b.new_page(viewport={"width": 1500, "height": 1000}, device_scale_factor=1.5)
await pg.goto(f"https://parastoo.zebellkhan.com{path}", wait_until="networkidle", timeout=90000)
await pg.wait_for_timeout(3000)
await pg.evaluate(f"() => document.querySelector('#tabs button[data-view=\"{tab}\"]')?.click()")
await pg.wait_for_timeout(3500)
await pg.screenshot(path=f"{OUT}/{name}.png", full_page=True)
print("captured", name)
await pg.close()
await b.close()
asyncio.run(main())