From ca05aa50a03baadecd2cf7dfee7b637ffca86255 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Matej=20Ba=C4=8Do?= Date: Thu, 27 Feb 2025 17:34:00 +0100 Subject: [PATCH 1/3] Fixes after Appwrite QA --- package.json | 2 +- pnpm-lock.yaml | 24 ++++++++++++------------ src/index.js | 9 ++++++++- 3 files changed, 21 insertions(+), 14 deletions(-) diff --git a/package.json b/package.json index 94a8907..ca4e3b1 100644 --- a/package.json +++ b/package.json @@ -18,7 +18,7 @@ "dependencies": { "h3": "^1.13.0", "lighthouse": "^12.2.1", - "playwright": "^1.48.1", + "playwright": "^1.50.1", "playwright-lighthouse": "^4.0.0", "zod": "^3.23.8" }, diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index 58efb4e..16f06bc 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -15,11 +15,11 @@ importers: specifier: ^12.2.1 version: 12.2.1 playwright: - specifier: ^1.48.1 - version: 1.48.1 + specifier: ^1.50.1 + version: 1.50.1 playwright-lighthouse: specifier: ^4.0.0 - version: 4.0.0(lighthouse@12.2.1)(playwright-core@1.48.1) + version: 4.0.0(lighthouse@12.2.1)(playwright-core@1.50.1) zod: specifier: ^3.23.8 version: 3.23.8 @@ -777,8 +777,8 @@ packages: pend@1.2.0: resolution: {integrity: sha512-F3asv42UuXchdzt+xXqfW1OGlVBe+mxa2mqI0pg5yAHZPvFmY3Y6drSf/GQ1A86WgWEN9Kzh/WrgKa6iGcHXLg==} - playwright-core@1.48.1: - resolution: {integrity: sha512-Yw/t4VAFX/bBr1OzwCuOMZkY1Cnb4z/doAFSwf4huqAGWmf9eMNjmK7NiOljCdLmxeRYcGPPmcDgU0zOlzP0YA==} + playwright-core@1.50.1: + resolution: {integrity: sha512-ra9fsNWayuYumt+NiM069M6OkcRb1FZSK8bgi66AtpFoWkg2+y0bJSNmkFrWhMbEBbVKC/EruAHH3g0zmtwGmQ==} engines: {node: '>=18'} hasBin: true @@ -792,8 +792,8 @@ packages: playwright-core: optional: true - playwright@1.48.1: - resolution: {integrity: sha512-j8CiHW/V6HxmbntOfyB4+T/uk08tBy6ph0MpBXwuoofkSnLmlfdYNNkFTYD6ofzzlSqLA1fwH4vwvVFvJgLN0w==} + playwright@1.50.1: + resolution: {integrity: sha512-G8rwsOQJ63XG6BbKj2w5rHeavFjy5zynBA9zsJMMtBoe/Uf757oG12NXz6e6OirF7RCrTVAKFXbLmn1RbL7Qaw==} engines: {node: '>=18'} hasBin: true @@ -1843,19 +1843,19 @@ snapshots: pend@1.2.0: {} - playwright-core@1.48.1: {} + playwright-core@1.50.1: {} - playwright-lighthouse@4.0.0(lighthouse@12.2.1)(playwright-core@1.48.1): + playwright-lighthouse@4.0.0(lighthouse@12.2.1)(playwright-core@1.50.1): dependencies: chalk: 4.1.2 lighthouse: 12.2.1 ua-parser-js: 1.0.39 optionalDependencies: - playwright-core: 1.48.1 + playwright-core: 1.50.1 - playwright@1.48.1: + playwright@1.50.1: dependencies: - playwright-core: 1.48.1 + playwright-core: 1.50.1 optionalDependencies: fsevents: 2.3.2 diff --git a/src/index.js b/src/index.js index 60e01b3..0266f10 100644 --- a/src/index.js +++ b/src/index.js @@ -48,7 +48,14 @@ router.post( extraHTTPHeaders: body.headers, }); const page = await context.newPage(); - await page.goto(body.url); + await page.goto(body.url, { + waitUntil: 'domcontentloaded', + }); + await page.waitForFunction(() => { + // eslint-disable-next-line + return document.fonts.ready + }); + await page.waitForTimeout(3000); // Safe addition for any extra JS const screen = await page.screenshot(); await context.close(); return screen; From 5593a7fa8a01e23a993e6c3ec6e8a2b683fc8e1d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Matej=20Ba=C4=8Do?= Date: Thu, 27 Feb 2025 17:36:09 +0100 Subject: [PATCH 2/3] Linter --- src/index.js | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/index.js b/src/index.js index 0266f10..dfabae1 100644 --- a/src/index.js +++ b/src/index.js @@ -49,11 +49,11 @@ router.post( }); const page = await context.newPage(); await page.goto(body.url, { - waitUntil: 'domcontentloaded', + waitUntil: "domcontentloaded", }); await page.waitForFunction(() => { - // eslint-disable-next-line - return document.fonts.ready + // eslint-disable-next-line + return document.fonts.ready; }); await page.waitForTimeout(3000); // Safe addition for any extra JS const screen = await page.screenshot(); From d78d9effe85d675c97d275329af8f76ce0eff13f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Matej=20Ba=C4=8Do?= Date: Mon, 3 Mar 2025 14:58:33 +0000 Subject: [PATCH 3/3] Simplify render await --- src/index.js | 4 ---- 1 file changed, 4 deletions(-) diff --git a/src/index.js b/src/index.js index dfabae1..49d323b 100644 --- a/src/index.js +++ b/src/index.js @@ -51,10 +51,6 @@ router.post( await page.goto(body.url, { waitUntil: "domcontentloaded", }); - await page.waitForFunction(() => { - // eslint-disable-next-line - return document.fonts.ready; - }); await page.waitForTimeout(3000); // Safe addition for any extra JS const screen = await page.screenshot(); await context.close();