fix: Pass --no-sandbox chrome CLI option when running the integration tests on travis (#85)
This commit is contained in:
parent
13d0ced89e
commit
94efb908b8
|
@ -14,7 +14,7 @@ script:
|
|||
- export DISPLAY=:99.0
|
||||
- sh -e /etc/init.d/xvfb start
|
||||
- echo "RUN integration tests on chrome" &&
|
||||
./test/run-chrome-smoketests.sh
|
||||
TRAVIS_CI=true ./test/run-chrome-smoketests.sh
|
||||
|
||||
after_script: npm run publish-coverage
|
||||
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
const finalhandler = require("finalhandler");
|
||||
const http = require("http");
|
||||
const serveStatic = require("serve-static");
|
||||
const puppeteer = require("puppeteer");
|
||||
|
||||
exports.createHTTPServer = async (path) => {
|
||||
var serve = serveStatic(path);
|
||||
|
@ -19,3 +20,25 @@ exports.createHTTPServer = async (path) => {
|
|||
});
|
||||
});
|
||||
};
|
||||
|
||||
exports.launchPuppeteer = async (puppeteerArgs) => {
|
||||
if (!puppeteerArgs || !Array.isArray(puppeteerArgs)) {
|
||||
throw new Error(`Invalid puppeteer arguments: ${JSON.stringify(puppeteerArgs)}`);
|
||||
}
|
||||
|
||||
const args = [].concat(puppeteerArgs);
|
||||
|
||||
// Pass the --no-sandbox chrome CLI option when running the integration tests
|
||||
// on Travis.
|
||||
if (process.env.TRAVIS_CI) {
|
||||
args.push("--no-sandbox");
|
||||
}
|
||||
|
||||
return puppeteer.launch({
|
||||
// Chrome Extensions are not currently supported in headless mode.
|
||||
headless: false,
|
||||
|
||||
// Custom chrome arguments.
|
||||
args,
|
||||
});
|
||||
};
|
||||
|
|
|
@ -4,9 +4,8 @@ const path = require("path");
|
|||
|
||||
const waitUntil = require("async-wait-until");
|
||||
const {deepEqual} = require("chai").assert;
|
||||
const puppeteer = require("puppeteer");
|
||||
|
||||
const {createHTTPServer} = require("./setup");
|
||||
const {createHTTPServer, launchPuppeteer} = require("./setup");
|
||||
|
||||
const fixtureExtensionDirName = "runtime-messaging-extension";
|
||||
|
||||
|
@ -20,15 +19,9 @@ describe("browser.runtime.onMessage/sendMessage", function() {
|
|||
|
||||
const url = `http://localhost:${server.address().port}`;
|
||||
|
||||
const browser = await puppeteer.launch({
|
||||
// Chrome Extensions are not currently supported in headless mode.
|
||||
headless: false,
|
||||
|
||||
// Custom chrome arguments.
|
||||
args: [
|
||||
const browser = await launchPuppeteer([
|
||||
`--load-extension=${process.env.TEST_EXTENSIONS_PATH}/${fixtureExtensionDirName}`,
|
||||
],
|
||||
});
|
||||
]);
|
||||
|
||||
const page = await browser.newPage();
|
||||
|
||||
|
|
Loading…
Reference in New Issue