From 11513787081b55613a5cb6679f8ea469ba7e3ce8 Mon Sep 17 00:00:00 2001 From: Adam Goldsmith Date: Fri, 3 Nov 2023 14:41:10 -0400 Subject: [PATCH] server/ipad: Wait for loading spinner to be hidden before capturing page --- server/src/server.ts | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/server/src/server.ts b/server/src/server.ts index 5b48c05..bc75143 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: 10000, + }); const screenshot = await puppet_page.screenshot(); await puppet_page.close(); res.send(screenshot);