const globby = require('globby');
const path = require('path');

let srcFolders = globby.sync([
  'packages/**/*.e2e.js',
  'apps/**/*.e2e.js',
  'test/*/*.e2e.js',
]);

srcFolders = srcFolders.map(function(folder) {
  return path.dirname(folder);
});

process.env.NOW_URL = process.env.NOW_URL || 'https://boltdesignsystem.com';

module.exports = {
  selenium: {
    start_process: true,
    server_path: require('selenium-server').path,
    log_path: './reports',
    host: '127.0.0.1',
    port: 4444,
    cli_args: {
      'webdriver.chrome.driver': './node_modules/chromedriver/bin/chromedriver',
    },
  },
  test_workers: { enabled: true, workers: 'auto' },
  test_settings: {
    local: {
      screenshots: {
        enabled: true,
        on_failure: true,
        on_error: true,
        path: 'reports/screenshots/',
      },
      filter: '**/*.e2e.js',
      selenium_port: 9515,
      selenium_host: 'localhost',
      default_path_prefix: '',
      desiredCapabilities: {
        browserName: 'chrome',
        chromeOptions: {
          args: ['headless'],
        },
      },
    },
    default: {
      screenshots: {
        enabled: true,
        on_failure: true,
        on_error: true,
        path: 'reports/screenshots/',
      },
      filter: '**/*.e2e.js',
      launch_url: 'http://ondemand.saucelabs.com:80',
      selenium_port: 80,
      selenium_host: 'ondemand.saucelabs.com',
      silent: true,
      username: process.env.SAUCE_USERNAME,
      access_key: process.env.SAUCE_ACCESS_KEY,
    },
    compatible_testcase_support: true,
    chrome: {
      desiredCapabilities: {
        browserName: 'chrome',
        platform: 'OS X 10.11',
        version: '70',
        javascriptEnabled: true,
        acceptSslCerts: true,
        chromeOptions: {
          args: ['headless'],
        },
      },
      build: `build-${process.env.TRAVIS_JOB_NUMBER}`,
      'tunnel-identifier': `${process.env.TRAVIS_JOB_NUMBER || ''}`,
    },
    ie11: {
      desiredCapabilities: {
        browserName: 'internet explorer',
        platform: 'Windows 10',
        version: '11.0',
      },
      build: `build-${process.env.TRAVIS_JOB_NUMBER}`,
      'tunnel-identifier': `${process.env.TRAVIS_JOB_NUMBER || ''}`,
    },
    firefox: {
      desiredCapabilities: {
        browserName: 'firefox',
        platform: 'OS X 10.11',
        version: '62',
      },
      build: `build-${process.env.TRAVIS_JOB_NUMBER}`,
      'tunnel-identifier': `${process.env.TRAVIS_JOB_NUMBER || ''}`,
    },
  },
  src_folders: srcFolders,
};

@@ -344,16 +344,19 @@
 ts = %7B%0A 
+ //
  seleniu
@@ -361,16 +361,19 @@
 ium: %7B%0A 
+ //
    start
@@ -389,16 +389,19 @@
  true,%0A 
+ //
    serve
@@ -442,16 +442,19 @@
 .path,%0A 
+ //
    log_p
@@ -472,16 +472,19 @@
 orts',%0A 
+ //
    host:
@@ -499,18 +499,21 @@
 0.1',%0A  
+//
   
+ 
 port: 44
@@ -517,16 +517,19 @@
  4444,%0A 
+ //
    cli_a
@@ -532,24 +532,27 @@
 li_args: %7B%0A 
+ //
      'webdri
@@ -620,28 +620,37 @@
 iver',%0A 
+ //
    %7D,%0A 
+ //
  %7D,%0A 
+ //
  test_wo

disable selenium server in nightwatch