Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
import path from 'path';
import chromedriver from 'chromedriver';
import webdriver from 'selenium-webdriver';
import { expect } from 'chai';
import electronPath from 'electron-prebuilt';
import homeStyles from '../app/components/Home.module.css';
import counterStyles from '../app/components/Counter.module.css';
chromedriver.start(); // on port 9515
process.on('exit', chromedriver.stop);
const delay = time => new Promise(resolve => setTimeout(resolve, time));
describe('main window', function spec() {
this.timeout(5000);
before(async () => {
await delay(1000); // wait chromedriver start time
this.driver = new webdriver.Builder()
.usingServer('http://localhost:9515')
.withCapabilities({
chromeOptions: {
binary: electronPath,
args: ['app=' + path.resolve()]
}
async createBrowser() {
// always create new browser session if not BrowserStack
if (!browser) {
if (!isBrowserStack) {
driverPort = await getPort()
chromedriver.start([`--port=${driverPort}`])
// https://github.com/giggio/node-chromedriver/issues/117
await waitPort({
port: driverPort,
timeout: 1000 * 60 * 2, // 2 Minutes
})
}
browser = wd.promiseChainRemote(
...(isBrowserStack
? [
'hub-cloud.browserstack.com', // seleniumHost
80, // seleniumPort
BROWSERSTACK_USERNAME,
BROWSERSTACK_ACCESS_KEY,
]
import path from 'path';
import chromedriver from 'chromedriver';
import webdriver from 'selenium-webdriver';
import { expect } from 'chai';
import electronPath from 'electron-prebuilt';
import homeStyles from '../app/components/Home.module.css';
import counterStyles from '../app/components/Counter.module.css';
chromedriver.start(); // on port 9515
process.on('exit', chromedriver.stop);
const delay = time => new Promise(resolve => setTimeout(resolve, time));
describe.skip('main window', function spec() {
this.timeout(5000);
before(async () => {
await delay(1000); // wait chromedriver start time
this.driver = new webdriver.Builder()
.usingServer('http://localhost:9515')
.withCapabilities({
chromeOptions: {
binary: electronPath,
args: ['app=' + path.resolve()]
}
import path from 'path';
import chromedriver from 'chromedriver';
import webdriver from 'selenium-webdriver';
import { expect } from 'chai';
import electronPath from 'electron-prebuilt';
chromedriver.start(); // on port 9515
process.on('exit', chromedriver.stop);
const delay = time => new Promise(resolve => setTimeout(resolve, time));
describe('main window', function spec() {
this.timeout(5000);
let shares; // Store the generated shares for recovery
const quorum = 2;
const numShares = 3;
const secret = 'test secret';
before(async () => {
await delay(1000); // wait chromedriver start time
this.driver = new webdriver.Builder()
.usingServer('http://localhost:9515')
.withCapabilities({
import path from 'path';
import chromedriver from 'chromedriver';
import webdriver from 'selenium-webdriver';
import { expect } from 'chai';
import electronPath from 'electron-prebuilt';
import homeStyles from '../app/components/Home.css';
import counterStyles from '../app/components/Counter.css';
chromedriver.start(); // on port 9515
process.on('exit', chromedriver.stop);
const delay = time => new Promise(resolve => setTimeout(resolve, time));
describe('main window', function spec() {
this.timeout(5000);
before(async () => {
await delay(1000); // wait chromedriver start time
this.driver = new webdriver.Builder()
.usingServer('http://localhost:9515')
.withCapabilities({
chromeOptions: {
binary: electronPath,
args: [`app=${path.resolve()}`]
}
export function startChromeDriver () {
if (chromedriverIsStarted) return Promise.resolve()
chromedriver.start()
process.on('exit', () => {
chromedriver.stop()
})
chromedriverIsStarted = true
return delay(1000)
}
startBrowser(browser) {
var driver = new Webdriver.Builder()
.forBrowser(browser)
.build();
chromedriver.start();
return driver;
}
function startBrowser(browserName, cdriverArgs) {
browser = browserName || browser;
chromedriverArgs = cdriverArgs || chromedriverArgs;
chromedriver.start(chromedriverArgs);
driver = new Webdriver.Builder()
.forBrowser(browser)
.build();
}
return new Promise(async (resolve, reject) => {
const port = await getPort();
let iBrowser = null;
const flags = ['--url-base=webdriver', '--verbose', `--port=${port}`, '--whitelisted-ips'];
debug(`Launching ChromeDriver with args: ${JSON.stringify(flags)}`);
const chromeProcess: ChildProcess = await chromeDriver.start(flags, true);
const findPort = new Transform({
transform: async (chunk, _, done) => {
const message = chunk.toString();
const match = message.match(/DevTools listening on (ws:\/\/.*)/);
if (match) {
chromeProcess.stderr && chromeProcess.stderr.unpipe(findPort);
const [, wsEndpoint] = match;
debug(`Attaching to chromedriver browser on ${wsEndpoint}`);
const browser: puppeteer.Browser = await puppeteer.connect({ browserWSEndpoint: wsEndpoint });
iBrowser = await setupBrowser({
blockAds,
browser,
browserlessDataDir: null,