From 101f816b1fd03f408ac0436d1a4abc796850e6ce Mon Sep 17 00:00:00 2001 From: bosd Date: Mon, 30 Oct 2023 21:00:49 +0100 Subject: [PATCH] [FIX] gen_addon_icon: wait until icons are displayed --- tools/gen_addon_icon.py | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/tools/gen_addon_icon.py b/tools/gen_addon_icon.py index e7ae2926..1500f78a 100644 --- a/tools/gen_addon_icon.py +++ b/tools/gen_addon_icon.py @@ -132,11 +132,16 @@ async def generate_template_screenshot(template, options, filetype): styles_filename = os.path.join(os.path.dirname(__file__), "gen_addon_icon.css") browser = await launch(headless=True, args=minimal_args) page = await browser.newPage() - await page.goto("data:text/html,{}".format(template)) + await page.goto( + "data:text/html,{}".format(template), {"waitUntil": "domcontentloaded"} + ) for url in SUPPORTED_SERVICE_URLS: await page.addStyleTag({"url": url}) await page.addStyleTag({"path": styles_filename}) await page.emulateMedia("screen") + await page.mouse.click( + 0, 0, {"delay": 500} + ) # hack to wait until icons are displayed if filetype in ["png", "jpg"]: await page.screenshot(options) else: