var expect = require('chai').expect;
var webdriverio = require('webdriverio');

var connect = require('connect');
var serveStatic = require('serve-static');
var path = require('path');

var exec = require('child_process').exec;

var gulppath = path.join(require.resolve('gulp'), '../bin/gulp.js');

var SITE_LOAD_TIMEOUT = 30000;

var webdriverOpts = {
  name: 'TestBed-Test',
  host: 'ondemand.saucelabs.com',
  port: 80,
  user: process.env.SAUCE_USERNAME,
  key: process.env.SAUCE_ACCESS_KEY,
  desiredCapabilities: {
    browserName: 'chrome',
    'tunnel-identifier': process.env.TRAVIS_JOB_NUMBER
  }
};

exec('node ' + gulppath + ' build', function() {
  connect().use(serveStatic(path.join(__dirname, '../dist'))).listen(8000);
  run();
});

describe('Win 10 Testbed E2E', function() {
  this.timeout(99999999);
  this.client = {};

  before(function(done) {
    this.client = webdriverio.remote(webdriverOpts);
    this.client.init(done);
  });

  describe('navigating to sites', require('./webdriver/navigateTest').bind(this));

  describe('checking added sites', function() {
    it ('keeps the list of sites stored', function(done) {
      this.client
      .url('http://localhost:8000')
      .pause(3000)
      .call(done);
    });
  });

  describe('removing sites', function() {
  });

  after(function(done) {
    this.client.end(done);
  });

});

@@ -350,32 +350,8 @@
 = %7B%0A
-  name: 'TestBed-Test',%0A
   ho
@@ -490,16 +490,42 @@
 ties: %7B%0A
+    name: 'TestBed-Test',%0A
     brow

move name to correct place