Skip to content

Commit

Permalink
Adding screenshots to e2e tests
Browse files Browse the repository at this point in the history
  • Loading branch information
chron0 committed Aug 17, 2016
1 parent e90d270 commit dd1242d
Show file tree
Hide file tree
Showing 2 changed files with 43 additions and 11 deletions.
1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@
"karma-phantomjs-launcher": "1.0.1",
"phantomjs-prebuilt": "2.1.11",
"protractor": "4.0.3",
"protractor-jasmine2-screenshot-reporter": "^0.3.2",
"run-sequence": "1.2.2",
"ts-node": "1.2.2",
"tsify": "1.0.3",
Expand Down
53 changes: 42 additions & 11 deletions test/protractor.conf.js
Original file line number Diff line number Diff line change
@@ -1,8 +1,20 @@
var HtmlScreenshotReporter = require('protractor-jasmine2-screenshot-reporter');

var reporter = new HtmlScreenshotReporter ({
dest: 'coverage/screenshots',
pathBuilder: function(currentSpec, suites) {
var name = currentSpec.fullName
var testname = name.replace(/\s+/g, '-').toLowerCase();
return testname;
},
filename: 'index.html'
});

exports.config = {
baseUrl: 'http://localhost:8100',

specs: [
'../www/build/test/**/*.e2e.js'
'../www/build/test/**/*.e2e.js'
],

exclude: [],
Expand All @@ -12,27 +24,46 @@ exports.config = {
allScriptsTimeout: 110000,

jasmineNodeOpts: {
showTiming: true,
showColors: true,
isVerbose: false,
includeStackTrace: false,
defaultTimeoutInterval: 400000
showTiming: true,
showColors: true,
isVerbose: false,
includeStackTrace: false,
defaultTimeoutInterval: 400000
},

directConnect: true,

capabilities: {
'browserName': 'chrome'
'browserName': 'chrome'
},

beforeLaunch: function() {
return new Promise(function(resolve){
reporter.beforeLaunch(resolve);
});
},

onPrepare: function() {
var SpecReporter = require('jasmine-spec-reporter');
// add jasmine spec reporter
jasmine.getEnv().addReporter(new SpecReporter({displayStacktrace: true}));
jasmine.getEnv().addReporter(reporter);
var SpecReporter = require('jasmine-spec-reporter');

// Add jasmine spec reporter
jasmine.getEnv().addReporter(new SpecReporter({displayStacktrace: true}));

// Define browser size for tests/screenshots
var width = 360;
var height = 640;
browser.driver.manage().window().setSize(width, height);

browser.ignoreSynchronization = false;
browser.ignoreSynchronization = false;
},

// Close the report after all tests finish
afterLaunch: function(exitCode) {
return new Promise(function(resolve){
reporter.afterLaunch(resolve.bind(this, exitCode));
});
},

/**
* Angular 2 configuration
Expand Down

0 comments on commit dd1242d

Please sign in to comment.