DEV: Switch from puppeteer to puppeteer-core for smoke test (#15262)

`puppeteer` includes a full chromium binary, which adds more than 300mb to our node_modules directory in development/test mode (and therefore the `discourse_dev` and `discourse_test` docker images). We already reach out to the system copy of Chrome for our qunit tests, and already have chrome installed in our `discourse_dev`/`discourse_test` docker images, so it's much more efficient to switch to `puppeteer-core` which doesn't include the chromium binary.
This commit is contained in:
David Taylor
2021-12-13 09:31:49 +00:00
committed by GitHub
parent 5fc42bf769
commit bc6bff0e5a
3 changed files with 166 additions and 81 deletions

View File

@ -11,14 +11,16 @@ const url = args[0];
console.log(`Starting Discourse Smoke Test for ${url}`);
const puppeteer = require("puppeteer");
const chromeLauncher = require("chrome-launcher");
const puppeteer = require("puppeteer-core");
const path = require("path");
(async () => {
const browser = await puppeteer.launch({
executablePath: chromeLauncher.Launcher.getInstallations()[0],
// when debugging locally setting the SHOW_BROWSER env variable can be very helpful
headless: process.env.SHOW_BROWSER === undefined,
args: ["--disable-local-storage", "--no-sandbox"]
args: ["--disable-local-storage", "--no-sandbox"],
});
const page = await browser.newPage();