Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions azure-pipelines.yml
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,8 @@ extends:
inputs:
command: "custom"
customCommand: "ci"
env:
PUPPETEER_SKIP_DOWNLOAD: "true"
- task: CmdLine@2
displayName: Build
inputs:
Expand Down
29 changes: 29 additions & 0 deletions jest-puppeteer.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,34 @@
* Licensed under the MIT License.
*/

const { existsSync } = require("node:fs");

const resolveExecutablePath = () => {
if (process.env.PUPPETEER_EXECUTABLE_PATH !== undefined) {
return process.env.PUPPETEER_EXECUTABLE_PATH;
}

const candidatesByPlatform = {
darwin: ["/Applications/Google Chrome.app/Contents/MacOS/Google Chrome"],
linux: ["/usr/bin/google-chrome", "/usr/bin/google-chrome-stable"],
win32: [
"C:\\Program Files\\Google\\Chrome\\Application\\chrome.exe",
"C:\\Program Files (x86)\\Google\\Chrome\\Application\\chrome.exe",
],
};
const candidates = candidatesByPlatform[process.platform] ?? [];
const executablePath = candidates.find((path) => existsSync(path));
if (executablePath !== undefined) {
return executablePath;
}

if (process.env.PUPPETEER_SKIP_DOWNLOAD === "true") {
throw new Error(
"No Chrome executable found. Set PUPPETEER_EXECUTABLE_PATH to a valid browser path.",
);
}
};

module.exports = {
server: {
command: `npm run start:client -- --port=7575`,
Expand All @@ -12,6 +40,7 @@ module.exports = {
launch: {
slowMo: 30, // slows down process for easier viewing
headless: "new", // run in the browser; https://developer.chrome.com/articles/new-headless/
executablePath: resolveExecutablePath(),
args: ["--no-sandbox", "--disable-setuid-sandbox"], // https://github.com/puppeteer/puppeteer/blob/master/docs/troubleshooting.md#setting-up-chrome-linux-sandbox
dumpio: process.env.FLUID_TEST_VERBOSE !== undefined, // output browser console to cmd line
},
Expand Down
1 change: 1 addition & 0 deletions jest.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@

module.exports = {
preset: "jest-puppeteer",
testEnvironment: "./test/jest-puppeteer-environment.js",
globals: {
PATH: `http://localhost:7575`,
},
Expand Down
Loading