承诺并没有等到jasmineDone的决心

时间:2017-10-15 05:24:14

标签: angular protractor nodes jasmine2.0

我试图将结果发布在testrail门户网站上,但这件事似乎没有用。我正在使用此插件https://www.npmjs.com/package/testrail-api 并试图在茉莉花定制记者中做到这一点

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);
    });
  }

1 个答案:

答案 0 :(得分:1)

对于自定义报告,您需要在量角器的配置文件中使用以下jasmine模块: 从npm执行命令:  1. npm i protractor-jasmine2-screenshot-reporter  2.下面是代码片段:

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));

            });