import asyncio, json from playwright.async_api import async_playwright async def main(): async with async_playwright() as p: b = await p.chromium.launch(args=["--no-sandbox"]) pg = await b.new_page(viewport={"width": 393, "height": 852}, device_scale_factor=2, is_mobile=True, has_touch=True) logs = [] pg.on("console", lambda m: logs.append(f"[{m.type}] {m.text}")) await pg.goto("https://parastoo.zebellkhan.com/", wait_until="networkidle", timeout=90000) await pg.wait_for_timeout(3000) # 1) Tap FAB to open task modal fab = await pg.evaluate("""() => { const f = document.querySelector('.fab'); return f ? {visible: f.offsetWidth > 0, text: f.innerText.trim()} : null; }""") print("FAB:", json.dumps(fab, ensure_ascii=False)) if fab and fab.get("visible"): await pg.click('.fab') await pg.wait_for_timeout(1500) # 2) Fill in a test task await pg.fill('#fTitle', 'تست سینک خودکار از موبایل') await pg.select_option('#fCat', 'instagram') await pg.fill('#fEst', '0.5') await pg.fill('#fAct', '0.5') await pg.select_option('#fStatus', 'done') # 3) Take screenshot of the filled modal await pg.screenshot(path="/workspace/parastoo_dashboard/audit/mobile_modal.png") # 4) Click save await pg.click('button:has-text("ذخیره")') await pg.wait_for_timeout(4000) # wait for autoSync # 5) Check the console for autoSync logs sync_logs = [l for l in logs if "autoSync" in l or "sync" in l.lower()] # 6) Check if the task was synced result = await pg.evaluate("""() => { const t = tasks.find(x => x.title === 'تست سینک خودکار از موبایل'); return t ? { title: t.title, synced_sheet: t.synced_sheet, synced_jira: t.synced_jira, jira: t.jira || '' } : null; }""") print("TASK:", json.dumps(result, ensure_ascii=False)) print("SYNC LOGS:", sync_logs[:5]) else: print("FAB not visible on mobile!") # 7) Final mobile layout check layout = await pg.evaluate("""() => ({ hOverflow: document.documentElement.scrollWidth - document.documentElement.clientWidth, headerH: document.querySelector('.top')?.getBoundingClientRect().height, fabRect: (() => { const f = document.querySelector('.fab'); return f ? {x: Math.round(f.getBoundingClientRect().x), y: Math.round(f.getBoundingClientRect().y), w: Math.round(f.getBoundingClientRect().width)} : null; })() })""") print("LAYOUT:", json.dumps(layout, ensure_ascii=False)) print("ALL LOGS:", [l for l in logs if l.startswith("[error]")][:5]) await b.close() asyncio.run(main())