import asyncio
from playwright.async_api import async_playwright

async def render():
    async with async_playwright() as p:
        browser = await p.chromium.launch()

        # 1080x1080
        page = await browser.new_page(viewport={"width": 1080, "height": 1080})
        await page.goto(f"file:///home/jay/workspace/output/banners/versions/v-round2/cell-1-incar-fair/cell1-1080x1080.html")
        await page.wait_for_timeout(2000)
        await page.screenshot(path="/home/jay/workspace/output/banners/versions/v-round2/cell-1-incar-fair/cell1-1080x1080.png")
        print("1080x1080 렌더링 완료")

        # 1200x628
        page2 = await browser.new_page(viewport={"width": 1200, "height": 628})
        await page2.goto(f"file:///home/jay/workspace/output/banners/versions/v-round2/cell-1-incar-fair/cell1-1200x628.html")
        await page2.wait_for_timeout(2000)
        await page2.screenshot(path="/home/jay/workspace/output/banners/versions/v-round2/cell-1-incar-fair/cell1-1200x628.png")
        print("1200x628 렌더링 완료")

        await browser.close()

asyncio.run(render())
