From ef5dccfd1aae7cabeb1d806854c6dcd4f517b8b6 Mon Sep 17 00:00:00 2001 From: Arthur Lu Date: Fri, 18 Nov 2022 23:26:51 -0800 Subject: [PATCH] temp fix issue with root user --- source/assets/scripts/main.e2e.test.js | 21 +++++++++++++++------ 1 file changed, 15 insertions(+), 6 deletions(-) diff --git a/source/assets/scripts/main.e2e.test.js b/source/assets/scripts/main.e2e.test.js index 43817ff..8ac6e0e 100644 --- a/source/assets/scripts/main.e2e.test.js +++ b/source/assets/scripts/main.e2e.test.js @@ -9,14 +9,23 @@ describe("test App end to end", async () => { let page; before(async () => { - browser = await puppeteer.launch(); - page = await browser.newPage(); - try{ - await page.goto("http://localhost:8080", {timeout: 5000}); + let root; + try { + root = process.getuid() == 0; } catch (error) { - console.log("❌ failed to connect to localhost webserver on port 8080"); - exit(1); + root = false; + } + + browser = await puppeteer.launch({args: root ? ['--no-sandbox'] : undefined}); + page = await browser.newPage(); + try{ + await page.goto("http://localhost:8080", {timeout: 1000}); + await console.log(`✔ connected to localhost webserver as ${root ? "root" : "user"}`); + } + catch (error) { + await console.log("❌ failed to connect to localhost webserver on port 8080"); + await exit(1); } });