Skip to content

Commit

Permalink
[FIX] gen_addon_icon: wait until icons are displayed
Browse files Browse the repository at this point in the history
  • Loading branch information
bosd committed Oct 30, 2023
1 parent 06aaf8a commit 2eabc65
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion tools/gen_addon_icon.py
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down

0 comments on commit 2eabc65

Please sign in to comment.