Skip to content

Commit

Permalink
Merge pull request #11807 from timvandermeij/puppeteer
Browse files Browse the repository at this point in the history
Introduce Puppeteer for handling browsers during tests
  • Loading branch information
timvandermeij authored Apr 27, 2020
2 parents bf416db + 9ebb18f commit d469b42
Show file tree
Hide file tree
Showing 12 changed files with 516 additions and 469 deletions.
39 changes: 7 additions & 32 deletions gulpfile.js
Original file line number Diff line number Diff line change
Expand Up @@ -415,21 +415,6 @@ function createTestSource(testsName, bot) {
console.log("### Running " + testsName + " tests");

var PDF_TEST = process.env.PDF_TEST || "test_manifest.json";
var PDF_BROWSERS =
process.env.PDF_BROWSERS ||
"resources/browser_manifests/browser_manifest.json";

if (!checkFile("test/" + PDF_BROWSERS)) {
console.log(
"Browser manifest file test/" + PDF_BROWSERS + " does not exist."
);
console.log(
"Copy and adjust the example in test/resources/browser_manifests."
);
this.emit("error", new Error("Missing manifest file"));
return null;
}

var args = ["test.js"];
switch (testsName) {
case "browser":
Expand All @@ -448,10 +433,12 @@ function createTestSource(testsName, bot) {
this.emit("error", new Error("Unknown name: " + testsName));
return null;
}
args.push("--browserManifestFile=" + PDF_BROWSERS);
if (bot) {
args.push("--strictVerify");
}
if (process.argv.includes("--noChrome")) {
args.push("--noChrome");
}

var testProcess = startNode(args, { cwd: TEST_DIR, stdio: "inherit" });
testProcess.on("close", function (code) {
Expand All @@ -466,26 +453,14 @@ function makeRef(done, bot) {
console.log();
console.log("### Creating reference images");

var PDF_BROWSERS =
process.env.PDF_BROWSERS ||
"resources/browser_manifests/browser_manifest.json";

if (!checkFile("test/" + PDF_BROWSERS)) {
console.log(
"Browser manifest file test/" + PDF_BROWSERS + " does not exist."
);
console.log(
"Copy and adjust the example in test/resources/browser_manifests."
);
done(new Error("Missing manifest file"));
return;
}

var args = ["test.js", "--masterMode"];
if (bot) {
args.push("--noPrompts", "--strictVerify");
}
args.push("--browserManifestFile=" + PDF_BROWSERS);
if (process.argv.includes("--noChrome")) {
args.push("--noChrome");
}

var testProcess = startNode(args, { cwd: TEST_DIR, stdio: "inherit" });
testProcess.on("close", function (code) {
done();
Expand Down
Loading

0 comments on commit d469b42

Please sign in to comment.