Skip to content

Commit

Permalink
Add an option (i.e. --noFirefox) to only use Chrome when running tests
Browse files Browse the repository at this point in the history
  • Loading branch information
calixteman committed Aug 31, 2024
1 parent ff76217 commit 1b0bfca
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 1 deletion.
6 changes: 6 additions & 0 deletions gulpfile.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -707,6 +707,9 @@ function runTests(testsName, { bot = false, xfaOnly = false } = {}) {
if (process.argv.includes("--noChrome") || forceNoChrome) {
args.push("--noChrome");
}
if (process.argv.includes("--noFirefox")) {
args.push("--noFirefox");
}
if (process.argv.includes("--headless")) {
args.push("--headless");
}
Expand Down Expand Up @@ -739,6 +742,9 @@ function makeRef(done, bot) {
if (process.argv.includes("--noChrome") || forceNoChrome) {
args.push("--noChrome");
}
if (process.argv.includes("--noFirefox")) {
args.push("--noFirefox");
}
if (process.argv.includes("--headless")) {
args.push("--headless");
}
Expand Down
13 changes: 12 additions & 1 deletion test/test.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,11 @@ function parseOptions() {
describe: "Skip Chrome when running tests.",
type: "boolean",
})
.option("noFirefox", {
default: false,
describe: "Skip Firefox when running tests.",
type: "boolean",
})
.option("noDownload", {
default: false,
describe: "Skip downloading of test PDFs.",
Expand Down Expand Up @@ -968,7 +973,13 @@ async function startBrowsers({ baseUrl, initializeSession }) {
// prevent the disk from filling up over time.
await puppeteer.trimCache();

const browserNames = options.noChrome ? ["firefox"] : ["firefox", "chrome"];
const browserNames = ["firefox", "chrome"];
if (options.noChrome) {
browserNames.splice(1, 1);
}
if (options.noFirefox) {
browserNames.splice(0, 1);
}
for (const browserName of browserNames) {
// The session must be pushed first and augmented with the browser once
// it's initialized. The reason for this is that browser initialization
Expand Down

0 comments on commit 1b0bfca

Please sign in to comment.