mirror of
https://github.com/hensm/fx_cast.git
synced 2026-06-08 08:39:59 +00:00
Simplify build scripts and implement preliminary tests
This commit is contained in:
47
test/driver.js
Normal file
47
test/driver.js
Normal 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
|
||||
}
|
||||
Reference in New Issue
Block a user