swissmanu / protractor-screenshot-reporter

Reporter for Protractor. Asks Selenium for a screenshot after every test case and stores it along with test case details.
https://github.com/swissmanu/protractor-screenshot-reporter
MIT License
65 stars 21 forks source link

don't work with protractor 2.0.0 #25

Open bessdsv opened 9 years ago

swissmanu commented 9 years ago

please provide further information (logs, error messages).

eddiemonge commented 9 years ago
  onPrepare: ->
    jasmine.getEnv().addReporter new ScreenShotReporter
      baseDirectory: path.resolve __dirname, 'results-e2e/screenshots'
      pathBuilder: ( spec, desc, results, capabilities ) ->
        path.join capabilities.caps_.browser, desc.join '-'

No images are stored in the baseDirectory and nothing in the protractor output relates to screenshots

kovpack commented 9 years ago

Yes, I've got the same problem.

eddiemonge commented 9 years ago

@swissmanu is that enough? I wonder if its because of jasmine 2 though

nervgh commented 9 years ago

Same here with protractor 2.2.0

SteveAquino commented 8 years ago

I don't know if it's helpful, but I've written my own reporter that works with the current version of protractor (3.0). It's very simple, but it could be used as a basis to update this project.

var fs = require('fs');

function writeScreenShot(data, filename) {
  var stream = fs.createWriteStream(filename);
  stream.write(new Buffer(data, 'base64'));
  stream.end();
}

function ScreenshotReporter(config) {
  this.config = config;
};

/*
 *  Create tmp/screenshots if it doesn't exist
 */
ScreenshotReporter.prototype.jasmineStarted = function(suiteInfo) {
  if(!fs.existsSync('tmp/screenshots')) { fs.mkdirSync('tmp/screenshots'); }
};

/*
 *  Take a screenshot and write it to the a
 *  parameterized file name based on the spec.
 */
ScreenshotReporter.prototype.specDone = function(result) {
  name = result.fullName.replace(/\W+/g, "-").replace(/^\W+/, '');
  browser.takeScreenshot().then(function (png) {
    writeScreenShot(png, 'tmp/screenshots/' + name + '.png');
  });
};

module.exports = ScreenshotReporter;
arnaugm commented 8 years ago

I'm having the same issue and @SteveAquino's reporter seems to work fine.