Simplify build scripts and implement preliminary tests

This commit is contained in:
hensm
2018-06-11 03:42:04 +01:00
parent 7cb626841f
commit f20f96cf10
19 changed files with 6021 additions and 11 deletions

47
test/driver.js Normal file
View File

@@ -0,0 +1,47 @@
"use strict";
const path = require("path");
const webdriver = require("selenium-webdriver");
const firefox = require("selenium-webdriver/firefox");
const chrome = require("selenium-webdriver/chrome");
const TEST_PAGE_URL = `file:///${__dirname}/test.html`;
const firefoxOptions = new firefox.Options()
.headless()
.addExtensions(path.resolve(__dirname, "../dist/ext.xpi"))
.setPreference("xpinstall.signatures.required", false);
const chromeOptions = new chrome.Options()
.excludeSwitches("disable-default-apps")
.addArguments(
"--load-media-router-component-extension");
async function create () {
const driver = new webdriver.Builder()
.forBrowser('firefox')
.setFirefoxOptions(firefoxOptions)
.setChromeOptions(chromeOptions)
.build();
await driver.get(TEST_PAGE_URL);
try {
// Allow access from other specs
this.driver = driver;
} catch (err) {}
return driver;
}
async function destroy () {
await this.driver.quit();
}
module.exports = {
create
, destroy
}