@@ -58,11 +58,14 @@ def render_into_template(
58
58
# --------------------------------------------------------------------------------------
59
59
# Browser Interactions
60
60
# --------------------------------------------------------------------------------------
61
- async def take_screenshots_at_all_resolutions (page : Page ) -> Dict [str , Image .Image ]:
61
+ async def take_screenshots_at_all_resolutions (
62
+ page : Page , url : str
63
+ ) -> Dict [str , Image .Image ]:
62
64
screenshots = {}
63
65
64
66
for name , resolution in SCREENSHOT_SIZES .items ():
65
67
await page .set_viewport_size (resolution )
68
+ await page .goto (url , wait_until = "load" )
66
69
await asyncio .sleep (1 ) # give the rendering logic a moment
67
70
68
71
size = (resolution ["width" ], resolution ["height" ])
@@ -84,12 +87,8 @@ async def render_at_multiple_resolutions(
84
87
page = await context .new_page ()
85
88
progress .advance (task , 1 )
86
89
87
- # progress.log(f"{theme.name}: Navigating to local URL.")
88
- await page .goto (theme .url , wait_until = "load" )
89
- progress .advance (task , 2 )
90
-
91
90
# progress.log(f"{theme.name}: Taking screenshots.")
92
- screenshots = await take_screenshots_at_all_resolutions (page )
91
+ screenshots = await take_screenshots_at_all_resolutions (page , theme . url )
93
92
progress .advance (task , 5 )
94
93
95
94
# progress.log(f"{theme.name}: Rendering to template.")
0 commit comments