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

screenshot folder deleted #14

Closed ft-bow closed 10 years ago

ft-bow commented 10 years ago

Hi

I have created a conf file with these settings.

jasmine.getEnv().addReporter(new HtmlReporter({ baseDirectory: 'screenshots', //takeScreenShotsOnlyForFailedSpecs: true, pathBuilder: function pathBuilder(spec, descriptions, results, capabilities) {

            var monthMap = {
                "1": "Jan",
                "2": "Feb",
                "3": "Mar",
                "4": "Apr",
                "5": "May",
                "6": "Jun",
                "7": "Jul",
                "8": "Aug",
                "9": "Sep",
                "10": "Oct",
                "11": "Nov",
                "12": "Dec"
            };

            var currentDate = new Date(),
                currentHoursIn24Hour = currentDate.getHours(),
                currentTimeInHours = currentHoursIn24Hour>12? currentHoursIn24Hour-12: currentHoursIn24Hour,
                totalDateString = currentDate.getDate()+'-'+ monthMap[currentDate.getMonth()+1]+ '-'+(currentDate.getYear()+1900) +
                    '-'+ currentTimeInHours+'h-' + currentDate.getMinutes()+'m';

            return path.join(totalDateString,capabilities.caps_.browserName, descriptions.join('-'));
        }
    }));

It creates the folder fine, but the next test run deletes all folders in "screenshots", how can i stop it from deleting the previous generated report folder?

softacid commented 10 years ago

any news? i have the same problem...

swissmanu commented 10 years ago

i see you reference the HtmlReporter on line 1. do you have the reporters mixed up somehow?

softacid commented 10 years ago

Hi , my conf file is looking like this:

var HtmlReporter = require('protractor-html-screenshot-reporter'); var path = require('path');

exports.config = { seleniumAddress: 'http://imptest2:80/wd/hub', specs: [ '../E2E/**/TC01_01_15_Enumeration.spec.js' ],

multiCapabilities: [
    {
    'browserName' : 'chrome',
    'ensureCleanSession': 'false'
    //'shardTestFiles': 'true'
}
    /*,{
        'browserName' : 'firefox'
    }*/ 
],

params: {
    global: {
        url: 'http://blabladomain',
        concern: '01'
    }
},

baseUrl: '',
onPrepare: function () {
    // Add a screenshot reporter:
    jasmine.getEnv().addReporter(new HtmlReporter({
        baseDirectory: '//192.168.1.78/wwwroot/Result/',
        takeScreenShotsOnlyForFailedSpecs: true,
        pathBuilder: function pathBuilder(spec, descriptions, results, capabilities) {

            var monthMap = {
                "1": "Jan",
                "2": "Feb",
                "3": "Mar",
                "4": "Apr",
                "5": "May",
                "6": "Jun",
                "7": "Jul",
                "8": "Aug",
                "9": "Sep",
                "10": "Oct",
                "11": "Nov",
                "12": "Dec"
            };

            var currentDate = new Date(),
                currentHoursIn24Hour = currentDate.getHours(),
                currentTimeInHours = currentHoursIn24Hour > 12? currentHoursIn24Hour - 12: currentHoursIn24Hour,
                totalDateString = currentDate.getDate() + '-' + monthMap[currentDate.getMonth() + 1] + '-' + (currentDate.getYear() + 1900) + 
                                  '-' + currentTimeInHours + 'h-' + currentDate.getMinutes() + 'm';

            return path.join(totalDateString, capabilities.caps_.browserName, descriptions.join('-'));
        }
    }));
}

};

swissmanu commented 10 years ago

this is the repository for protractor-screenshot-reporter. please conside filling an issue for protractor-html-screenshot-reporter here: