My protractor.conf.js has the following content. I was unable to find out whats wrong here. I have manually created target/screenshots in my root folder of angular-cli. When i run protractor conf.js the protractor tests in browser window but the screenshots aren't being generated. Can anyone help me resolve this?
// Protractor configuration file
const { SpecReporter } = require('jasmine-spec-reporter');
var HtmlScreenshotReporter = require('protractor-jasmine2-screenshot-reporter');
var fs = require('fs');
var reporter = new HtmlScreenshotReporter({
dest: 'target/screenshots',
filename: 'my-report.html',
cleanDestination: false,
showSummary: true,
showConfiguration: false,
reportTitle: null,
ignoreSkippedSpecs: false,
captureOnlyFailedSpecs: false,
reportOnlyFailedSpecs: false
});
exports.config = {
allScriptsTimeout: 11000,
specs: [
'./e2e/**/*.e2e-spec.ts'
],
capabilities: {
'browserName': 'chrome'
},
directConnect: false,
baseUrl: 'http://localhost:4200/',
framework: 'jasmine',
chromeOnly: true,
seleniumAddress: 'http://localhost:4444/wd/hub',
specs: ['spec.js'],
jasmineNodeOpts: {
showColors: true,
defaultTimeoutInterval: 30000,
print: function() {}
},
onPrepare() {
require('ts-node').register({
project: 'e2e/tsconfig.e2e.json'
});
jasmine.getEnv().addReporter(reporter);
},
afterLaunch: function(exitCode) {
return new Promise(function(resolve){
reporter.afterLaunch(resolve.bind(this, exitCode));
});
}
};
Thanks in Advance!
protractor-jasmine2-screenshot-reporter
compatible withjasmine2
, so change toframework: 'jasmine2'
in your conf.jsAnd you need to use higher version of
Protractor
which includesjasmine2
I did a quick test with your conf(did little changes) and it worked.
conf.js
spec.js
target/screenshots folder and HTML report, (I run for twice, so there are two screenshots.)
yyy
will open the screenshotprotractor-jasmine2-screenshot-reporter
will createtarget/screenshots
folder if not exist, no need to create in advance.Version I used:
You can check by adding the 'protractor-screenshoter-plugin'
Can also check https://www.npmjs.com/package/protractor-screenshoter-plugin