'use strict';

var path = require('path');

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

exports.config = {
	plugins: [{
		package: 'protractor-fail-fast'
	}],
	seleniumAddress: 'http://127.0.0.1:4444/wd/hub',
	specs: require('./specList').getAll(),
	capabilities: {
		browserName: 'chrome',
		'chromeOptions': {
			// Get rid of --ignore-certificate yellow warning
			args: ['--no-sandbox', '--test-type=browser'],
			// Set download path and avoid prompting for download even though
			// this is already the default on Chrome but for completeness
			prefs: {
				'download': {
					'prompt_for_download': false,
					'default_directory': path.resolve(__dirname, './downloads/'),
				},
			},
		}
	},
	allScriptsTimeout: 300 * 1000,	
	getPageTimeout: 300 * 1000,
	jasmineNodeOpts: {
		defaultTimeoutInterval: 300 * 1000
	},
	framework: 'jasmine2',
	onPrepare: function() {
		jasmine.getEnv().addReporter(failFast.init());
		var SpecReporter = require('jasmine-spec-reporter');
		return jasmine.getEnv().addReporter(new SpecReporter({
			displayStacktrace: true
		}));
	},
	afterLaunch: function() {
		failFast.clean(); // Cleans up the "fail file" (see below) 
	}  		

};