jeudi 21 septembre 2017

Browser closes immediately in protractor cucumber test when using cucumberopts format as Json

I am running a Protractor cucumber test and trying to generate report using protractor-multiple-cucumber-html-reporter-plugin.

But when I am using format:json:result.json in the config file the browser(chrome) immediately closes as soon as the test starts running and it shows all the test cases passed in the report.

But I wrote the scenarios in such a way that some test cases should fail.This only happens when I using format:json:result.json in cucumberOpts.

When I am using format:'pretty', browser works fine and it shows running of all the test cases and also it shows correct number of test cases passed and failed.

Please find my config file

const path = require('path');
exports.config = {
directConnect: true,
framework: 'custom',
frameworkPath: require.resolve('protractor-cucumber-framework'),
cucumberOpts: {
    require: [
         'maths.js',
    ],
    // Tell CucumberJS to save the JSON report
    format: 'json:.tmp/results.json',
    strict: true
},

specs: [
    '*.feature'
],

multiCapabilities: [{
    browserName: 'chrome',
    shardTestFiles: true,
    maxInstances: 2,
    chromeOptions: {
        args: ['disable-infobars']
    }
}],

// Here the magic happens
plugins: [{
    package: 'protractor-multiple-cucumber-html-reporter-plugin',
    options:{
         automaticallyGenerateReport: true,
         removeExistingJsonReportFile: true
    }
}]

};

Aucun commentaire:

Enregistrer un commentaire