Search code examples
htmlprotractorjasmine2.0jasmine-reporters

protractor-jasmine2-html-reporter doesn't show results for multicapabilities test


That Html Reporter works fine when one browser is used but multiple browsers using protractor's multicapabilities property results are not displayed.

Here is how my config looks in onPrepare method:

var Jasmine2HtmlReporter = require('protractor-jasmine2-html-reporter');
jasmine.getEnv().addReporter(new Jasmine2HtmlReporter({
    savePath: './reports/'
}));

I noticed the screenshots are available for other browsers runs in the reports/screenshot dir. Also, it prints the results of all browsers fine on command line. But it doesn't show anything in the html report other than results of one browser.

Is there a jasmine option I need to define? I tried the 'protractor-jasmine2-screenshot-reporter' and it works fine for multiple browser results.

sample report view


Solution

  • Since you only specify one path, each browser session is probably overwriting the results of a previous session. To create a unique id for each report, in your config you can do something like:

    var Jasmine2HtmlReporter = require('protractor-jasmine2-html-reporter');
    
    onPrepare: function() {
        return browser.getCapabilities().then(function(caps) {
            var sessionId = caps.caps_['webdriver.remote.sessionid'];
            jasmine.getEnv().addReporter(new Jasmine2HtmlReporter({
                savePath: './reports/' + sessionId
            }));
        }
    }