const HtmlReporter = require('protractor-beautiful-reporter'); const {SpecReporter} = require('jasmine-spec-reporter'); const path = require('path'); exports.config = { allScriptsTimeout: 11000, seleniumAddress: 'http://localhost:4444/wd/hub', // The port to start the selenium server on, or null if the server should // find its own unused port. seleniumPort: null, seleniumArgs: [], specs: [ './specs/*.spec.js', ], capabilities: { browserName: 'chrome', chromeOptions: { args: ['--window-size=1910,1080'], }, }, // A base URL for your application under test. Calls to protractor.get() // with relative paths will be prepended with this. baseUrl: 'http://localhost:9999', directConnect: true, framework: 'jasmine', onPrepare: function() { // Add a screenshot reporter: jasmine.getEnv().addReporter(new HtmlReporter({ preserveDirectory: false, takeScreenShotsOnlyForFailedSpecs: true, screenshotsSubfolder: 'images', jsonsSubfolder: 'jsons', baseDirectory: 'reports-tmp', clientDefaults: { columnSettings: { displaySessionId: false, }, }, pathBuilder: function pathBuilder(spec, descriptions, results, capabilities) { // Return '<30-12-2016>/<browser>/<specname>' as path for screenshots: // Example: '30-12-2016/firefox/list-should work'. const currentDate = new Date(); const day = currentDate.getDate(); const month = currentDate.getMonth() + 1; const year = currentDate.getFullYear(); const validDescriptions = descriptions.map(function(description) { return description.replace('/', '@'); }); return path.join( day + '-' + month + '-' + year, // capabilities.get('browserName'), validDescriptions.join('-')); }, }).getJasmine2Reporter()); }, jasmineNodeOpts: { showColors: true, defaultTimeoutInterval: 30000, print: function() {} }, onPrepare: function() { jasmine.getEnv().addReporter(new SpecReporter({ spec: { displayStacktrace: true } })); }, };