Ajay Suwalka
Ajay Suwalka

Reputation: 531

Promises are not waiting resolve in jasmineDone

I am trying to post the result on testrail portal but this thing doesn't seem to be working. I am using this plugin https://www.npmjs.com/package/testrail-api and trying to do it in jasmine custom reporter which is

jasmineDone: function () {
    var Testrail = require('testrail-api');

    var testrail = new Testrail({
      host: settings.testrail.host,
      user: settings.testrail.user,
      password: settings.testrail.password
    });

    testrail.getMilestones(1).then(function (err, cases) {
      console.log(cases);
    }).catch(function (err) {
      console.log('error', err);
    });
  }

Upvotes: 0

Views: 157

Answers (1)

Prakash
Prakash

Reputation: 21

For custom reporting you need to use the below module of jasmine in configuration file of protractor : From npm execute the command : 1. npm i protractor-jasmine2-screenshot-reporter 2. Below is the code snippets:

var HtmlScreenshotReporter = require('protractor-jasmine2-screenshot-reporter');
    var reporter = new HtmlScreenshotReporter({

      captureOnlyFailedSpecs: false,

      userCss: 'if any cascading required',

      dest: 'report path where need to be generated',

      filename: 'Name of file'.html',

      reportTitle: "if any title required"
    });

    jasmineNodeOpts: {

               showColors: true,

               defaultTimeoutInterval: 50000000,

               isVerbose: true
                },

        capabilities: {

            'shardTestFiles': true,

            'browserName': 'name of the browser where you need to execute',

            maxInstances: Number of instances of browser
        },

        framework: 'jasmine2',

        beforeLaunch: function() {

            return new Promise(function(resolve){

              reporter.beforeLaunch(resolve);

            });

        },
        onPrepare: function () 
    {
            browser.driver.manage().window().maximize();

            jasmine.getEnv().addReporter(reporter);
        },

    afterLaunch: function(exitCode) {

            return new Promise(function(resolve){

              reporter.afterLaunch(resolve.bind(this, exitCode));

            });

Upvotes: 1

Related Questions