diff --git a/server/src/server.ts b/server/src/server.ts index 5b48c05..a4a8f6f 100644 --- a/server/src/server.ts +++ b/server/src/server.ts @@ -22,8 +22,11 @@ app.get('/ipad.png', async (req, res) => { frontend_url.searchParams.set('tool', req.query.tool); } await puppet_page.goto(frontend_url.toString()); - // TODO: handle timeout - await puppet_page.waitForNetworkIdle({ timeout: 5000 }); + // TODO: handle timeout better (ie present a better error to the frontend) + await puppet_page.waitForSelector('#loadingSpinner', { + hidden: true, + timeout: 10, + }); const screenshot = await puppet_page.screenshot(); await puppet_page.close(); res.send(screenshot);