Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Adding screenshots to e2e tests #132

Merged
merged 1 commit into from
Aug 17, 2016
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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