Skip to content

Instantly share code, notes, and snippets.

@techyaura
Last active September 10, 2018 09:20
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save techyaura/339e5de837efba73a6ea9a5057bb2ed1 to your computer and use it in GitHub Desktop.
Save techyaura/339e5de837efba73a6ea9a5057bb2ed1 to your computer and use it in GitHub Desktop.
Protractor basic setup
exports.config = {
allScriptsTimeout: 100000,
//rootElement defaults to body.
//If you don't have your ng-app in the body, you will get that error
rootElement: 'body',
directConnect: true,
plugins: [
{
inline: require('protractor-console'),
logLevels: ['severe', 'warnings']
}
],
framework: 'jasmine',
seleniumAddress: 'http://localhost:4444/wd/hub',
specs: ['index.spec.js'],
capabilities: {
browserName: 'chrome',
chromeOptions: {
args: ["--disable-gpu", "--window-size=800,600" ]
}
},
onPrepare: function() {
// At this point, global 'protractor' object will be set up, and
// jasmine will be available.
"use strict";
var JUnitXmlReporter = require('jasmine-reporters');
jasmine.getEnv().addReporter(new JUnitXmlReporter.JUnitXmlReporter({
savePath: './reports',
consolidateAll: true
}));
var Jasmine2HtmlReporter = require('protractor-jasmine2-html-reporter');
jasmine.getEnv().addReporter(new Jasmine2HtmlReporter({
fileName: 'report',
savePath: './reports',
takeScreenshots: true,
takeScreenshotsOnlyOnFailures: true
}));
},
// ----- Options to be passed to minijasminenode -----
jasmineNodeOpts: {
/**
* onComplete will be called just before the driver quits.
*/
onComplete: function (passed) {
if(passed) {
console.log('All specs have passed');
}
else {
console.log('At least one spec has failed');
}
},
// If true, display spec names.
isVerbose: true,
// If true, print colors to the terminal.
showColors: true,
// If true, include stack traces in failures.
//includeStackTrace: true,
// Default time to wait in ms before a test fails.
defaultTimeoutInterval: 30000
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment