'use strict';
/* globals jasmine */

/**
 *  Refers to http://blog.yodersolutions.com/run-protractor-tests-in-parallel/ to configure this  file
 */

var failFast = require('protractor-fail-fast');

exports.config = {
	seleniumAddress: process.env.SELENIUM_ADDRESS,
	// seleniumAddress: 'http://172.17.42.1:4444/wd/hub',
	specs: require('./specList').getAll(),
	framework: 'jasmine2',
	capabilities: {
		browserName: 'firefox',
	},
	// in case it throws  Error: Timed out waiting for Protractor to synchronize with the page after 11 seconds. 
	// allScriptsTimeout: 300 * 1000,
	// getPageTimeout: 300 * 1000,
	// jasmineNodeOpts: {
	// 	defaultTimeoutInterval: 300 * 1000
	// },
	allScriptsTimeout: 200 * 1000,
	getPageTimeout: 200 * 1000,
	jasmineNodeOpts: {
		defaultTimeoutInterval: 200 * 1000
	},
	onPrepare: function() {
		jasmine.getEnv().addReporter(failFast.init());
		var SpecReporter = require('jasmine-spec-reporter');
		// add jasmine spec reporter
		return jasmine.getEnv().addReporter(new SpecReporter({
			displayStacktrace: true
		}));

	},
	afterLaunch: function() {
		failFast.clean(); // Cleans up the "fail file" (see below) 
	}
};

console.log(exports.config);