jintoppy / protractor-html-screenshot-reporter

An npm module which provides html reports of your Protractor tests with screenshots
MIT License
65 stars 99 forks source link

No Screenshot folder is being created when executed the scripts on two different nodes #7

Open BabuRamesh opened 10 years ago

BabuRamesh commented 10 years ago

I was able to configure html-screenshot-reporter and able to generate html reports and screenshots when I run tests in linear or on multiple browsers within the same machine. However, when I configure my protractor tests to run concurrently on two different nodes the 'screenshots' folder is not being created at all

jintoppy commented 10 years ago

Hm. Seems like it is a duplicate of Issue #2. Can you please create a sample repo with the failing scenario configuration?

BabuRamesh commented 10 years ago

Issue 2 is regarding 'Screenshots' folder not being generated while concurrent execution within same system. However, when I've tested the scenario I'm able to find screenshots folder during concurrent execution within same system.

But what I'm facing now is when I execute specs on two nodes, screenshots folder is not being created in the hub.

Below is my grunt file and additional details -

module.exports = function(grunt) {

grunt.initConfig({ pkg: grunt.file.readJSON('package.json'), //Protractor here is a grunt plug-in, which takes config file and selenium ports are params protractor:{ options:{ KeepAlive:true, configFile:'./Config/conf.js', args:{browser:'chrome'} },

    singlerun:{},

    auto:{
         keepAlive:true,
         options:{
               args:{
                    seleniumPort:4444
                    }
                }
    },
    feature1:{
        options:{
            configFile:'./Parallel/Featurelist1.js',
        }
    },
    feature2:{
        options:{
            configFile:'./Parallel/Featurelist2.js',
        }
    }

}, //Shell is grunt plug-in which basically runs commands from console. two commands here we perform are download webdriver-manager and install all //it's dependencies and webdriverserver_launch launches webdriver server concurrent:{

dev: [ 'protractor:feature1', 'protractor:feature2' ] }, shell:{ options:{ stdout:true }, protractor_install:{ command: 'node ./node_modules/protractor/bin/webdriver-manager update' }, webdriverserver_launch:{ command: 'node ./node_modules/protractor/bin/webdriver-manager start' },

npm_install:{ command:'npm install' }

}, //Grunt-open is another plug-in which opens html files on your favourite browsers open:{

report:{ path:'file:///C:/Users/Admin/Google Drive/Core/Automation/Frameworks/Protractor/screenshots/reporter.html', app: 'Firefox' } },

//grunt-clean is another plug-in which deletes files or folders clean:["screenshots"],

jshint:{ files: ['gruntfile.js', 'Specs/*.js'], options: { // options here to override JSHint defaults globals: { jQuery: true, console: true, module: true, document: true } }

} });

grunt.loadNpmTasks('grunt-contrib-jshint'); grunt.loadNpmTasks('grunt-protractor-runner'); grunt.loadNpmTasks('grunt-shell-spawn'); grunt.loadNpmTasks('grunt-contrib-connect'); grunt.loadNpmTasks('grunt-open'); grunt.loadNpmTasks('grunt-contrib-clean'); grunt.loadNpmTasks('grunt-concurrent'); grunt.registerTask('parallel',['clean','jshint','concurrent','open:report']); grunt.registerTask('linear',['clean','jshint','protractor:singlerun','open:report']); grunt.registerTask('install',['shell:npm_install','shell:protractor_install','shell:webdriverserver_launch']); grunt.registerTask('report',['open:report']); };


Featurelist1.js

var config = Object.create(require('./ptrConf').config);

_config.specs =['../Specs/Ancestry_Smokespec.js'];

exports.config = config;


Featurelist2.js

var config = Object.create(require('./ptrConf').config);

_config.specs =['../Specs/examplespec.js'];

exports.config = config;

Please let me know if you need additional information

jintoppy commented 10 years ago

Hi Babu, if possible, please create a sample repo with the failing scenario. That would help me save some time in setting up.

BabuRamesh commented 10 years ago

Hi Jose, Please refer to https://github.com/BabuRamesh/Protractor---ParallelExecution for the sample repo of failing scenario created.

Please let me know if you need additional information.

jintoppy commented 10 years ago

@sreekarun Can you please take a look

BabuRamesh commented 10 years ago

@jintoppy

Hi..!! I can see that still screenshots folder is not being created in the HUB after completion of execution in NODES.. Please let me know if you need additional information

softacid commented 10 years ago

did you managed to get an answer ? i have the same problem.

BabuRamesh commented 10 years ago

No.. However, we've tried using only protractor config file instead of Grunt Conf file and able to get the desired output in HTML. Regards,Babu From: softacid notifications@github.com To: jintoppy/protractor-html-screenshot-reporter protractor-html-screenshot-reporter@noreply.github.com Cc: Babu Ramesh babu.nukala@yahoo.com Sent: Friday, October 17, 2014 12:19 PM Subject: Re: [protractor-html-screenshot-reporter] No Screenshot folder is being created when executed the scripts on two different nodes (#7)

did you managed to get an answer ? i have the same problem.— Reply to this email directly or view it on GitHub.

sreekarun commented 10 years ago

Apologies. I did not get a chance to look at this. Can you detail your approach, then we can publish that workaround. Let me look at the real issue meanwhile.

On Fri, Oct 17, 2014 at 12:24 PM, Babu Ramesh notifications@github.com wrote:

No.. However, we've tried using only protractor config file instead of Grunt Conf file and able to get the desired output in HTML. Regards,Babu From: softacid notifications@github.com To: jintoppy/protractor-html-screenshot-reporter < protractor-html-screenshot-reporter@noreply.github.com> Cc: Babu Ramesh babu.nukala@yahoo.com Sent: Friday, October 17, 2014 12:19 PM Subject: Re: [protractor-html-screenshot-reporter] No Screenshot folder is being created when executed the scripts on two different nodes (#7)

did you managed to get an answer ? i have the same problem.— Reply to this email directly or view it on GitHub.

— Reply to this email directly or view it on GitHub https://github.com/jintoppy/protractor-html-screenshot-reporter/issues/7#issuecomment-59473227 .

softacid commented 10 years ago

In my case this is my conf file content : during the tests run the folder screenshor appera and dissapear , the reports are not concatenated in 1 file ..

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

exports.config = {

seleniumAddress: 'http://imptest2:80/wd/hub',
specs: [
    '../E2E/**/*.spec.js'
    ],

multiCapabilities: [
    {
    'browserName' : 'chrome',
    'ensureCleanSession': 'false',
    'shardTestFiles': 'true',
    maxInstances: 10
}
],

params: {
    global: {
        url: 'http://impiis/ServerTestsServices/WebClient',
        concern: '01'
    }
},
baseUrl: 'http://localhost:8090/',

allScriptsTimeout: 500000,
onPrepare: function () {

    // Add a screenshot reporter:
    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('-'));
        }
    }));
}

};