server/ipad: Wait for loading spinner to be hidden before capturing page
This commit is contained in:
parent
1c096df395
commit
41787763aa
@ -22,8 +22,11 @@ app.get('/ipad.png', async (req, res) => {
|
|||||||
frontend_url.searchParams.set('tool', req.query.tool);
|
frontend_url.searchParams.set('tool', req.query.tool);
|
||||||
}
|
}
|
||||||
await puppet_page.goto(frontend_url.toString());
|
await puppet_page.goto(frontend_url.toString());
|
||||||
// TODO: handle timeout
|
// TODO: handle timeout better (ie present a better error to the frontend)
|
||||||
await puppet_page.waitForNetworkIdle({ timeout: 5000 });
|
await puppet_page.waitForSelector('#loadingSpinner', {
|
||||||
|
hidden: true,
|
||||||
|
timeout: 10,
|
||||||
|
});
|
||||||
const screenshot = await puppet_page.screenshot();
|
const screenshot = await puppet_page.screenshot();
|
||||||
await puppet_page.close();
|
await puppet_page.close();
|
||||||
res.send(screenshot);
|
res.send(screenshot);
|
||||||
|
Loading…
Reference in New Issue
Block a user