temp fix issue with root user

This commit is contained in:
Arthur Lu 2022-11-18 23:26:51 -08:00
parent 274a05fdc2
commit ef5dccfd1a

View File

@ -9,14 +9,23 @@ describe("test App end to end", async () => {
let page; let page;
before(async () => { before(async () => {
browser = await puppeteer.launch(); let root;
page = await browser.newPage();
try { try {
await page.goto("http://localhost:8080", {timeout: 5000}); root = process.getuid() == 0;
} }
catch (error) { catch (error) {
console.log("❌ failed to connect to localhost webserver on port 8080"); root = false;
exit(1); }
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);
} }
}); });