'use strict';
/* globals jasmine */

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

var start, end;

exports.config = {
	seleniumAddress: process.env.SELENIUM_ADDRESS,
	// seleniumAddress: 'http://172.17.42.1:4444/wd/hub',
	specs: [
		'./spec/product-catalog/concurrent-editing.js'
	],
	framework: 'jasmine2',
	capabilities: {
		browserName: 'firefox',
		// count: 2,
		shardTestFiles: true,
		maxInstances: 4,
	},
	// 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() {
		start = new Date();
		var SpecReporter = require('jasmine-spec-reporter');
		// add jasmine spec reporter
		return jasmine.getEnv().addReporter(new SpecReporter({
			displayStacktrace: true
		}));
	},
	onComplete: function() {
		end = new Date();
		console.log('>>>');
		console.log('>>> Execution time is:', (end - start) / 1000, 'seconds');
		console.log('>>> Execution time is:', (end - start) / 1000 / 60, 'minutes');
		console.log('>>>');
	}

};