import webdriver from 'selenium-webdriver';

export function check(done, func) {
  try {
    func();
  } catch (ex) {
    done(ex);
  }
}

export function doBefore(done, action, load = './build/extension', port = 9515, browser = 'chrome') {
  this.driver = new webdriver.Builder()
    .usingServer(`http://localhost:${port}`)
    .withCapabilities({
      chromeOptions: {
        args: [
          '--disable-impl-side-painting',
          `load-extension=${load}`
        ]
      }
    })
    .forBrowser(browser)
    .build();
  action().then(() => done());
}

export function doAfter(done, timeout = 20000) {
  this.timeout(timeout);
  this.driver.quit().then(done);
}

import webdriver from 'selenium-webdriver';

export function check(done, func) {
  try {
    func();
  } catch (ex) {
    done(ex);
  }
}

export function doBefore(done, action, load = './build/extension', port = 9515, browser = 'chrome') {
  this.driver = new webdriver.Builder()
    .usingServer(`http://localhost:${port}`)
    .withCapabilities({
      chromeOptions: {
        args: [ `load-extension=${load}` ]
      }
    })
    .forBrowser(browser)
    .build();
  action().then(() => done());
}

export function doAfter(done, timeout = 20000) {
  this.timeout(timeout);
  this.driver.quit().then(done);
}

Revert "Attempt to fix travis issue"
Revert "Attempt to fix travis issue"

This reverts commit ce2aa5a0f384464bb94569a1336575d6dacafb78.
