javascript - protractor-html-screenshot-reporter 没有显示报告文件中执行的所有测试

标签 javascript angularjs testing protractor end-to-end

我正在尝试运行 firsttest.js:

// firsttest.js
describe('angularjs homepage', function() {
  var firstNumber = element(by.model('first'));
  var secondNumber = element(by.model('second'));
  var goButton = element(by.id('gobutton'));
  var latestResult = element(by.binding('latest'));

  beforeEach(function() {
    browser.get('http://juliemr.github.io/protractor-demo/');
  });

  it('should have a title', function() {
    expect(browser.getTitle()).toEqual('Super Calculator');
  });

  it('should add one and two', function() {

    firstNumber.sendKeys(1);
    secondNumber.sendKeys(2);

    goButton.click();

    expect(latestResult.getText()).toEqual('3');
  });

  it('should add four and six', function() {
    // Fill this in.
    expect(latestResult.getText()).toEqual('10');
  });

  it('test1', function() {
    // Fill this in.
    expect(true).toEqual(true);
  });

  it('test2', function() {
    // Fill this in.
    expect(true).toEqual(true);
  });

  it('test3', function() {
    // Fill this in.
    expect(true).toEqual(true);
  });

});

配置文件:

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

exports.config = {

  seleniumAddress: 'http://localhost:4444/wd/hub',
  specs: ['firsttest.js'],
  multiCapabilities: [{
    'browserName': 'chrome'
  }],
  onPrepare: function() {
    // Add a screenshot reporter and store screenshots to `/tmp/screnshots`:
    jasmine.getEnv().addReporter(new HtmlReporter({
      baseDirectory: './e2e-reports',
      takeScreenShotsOnlyForFailedSpecs: true,
      docTitle: 'Pytheas Tests'
    }));
  }
}

控制台:

Failures:

1) angularjs homepage should add four and six Message: Expected '0' to equal '10'. Stacktrace: Error: Failed expectation at [object Object]. (/Users/bgowda1/Work/Projects/Demos/protractor-tests/firsttest.js:35:36)

Finished in 6.191 seconds 6 tests, 6 assertions, 1 failure

HTML 报告仅显示 5 个测试。

最佳答案

我能够重现它 - 这始终是最终 HTML 报告中缺少的最新 it block 。这应该报告给 protractor-html-screenshot-reporter错误跟踪器。

作为当前的解决方法,降级到 Protractor 1.4.0(已测试,对我有用)。或者,在文件末尾添加一个空的 it() block 。如果我想出修复或更好的解决方法,我会更新帖子。

关于javascript - protractor-html-screenshot-reporter 没有显示报告文件中执行的所有测试,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/27907691/

相关文章:

javascript - 在样式表中指定多 css 类

javascript - 如何添加或包装每个标签和 div?

selenium - 错误 Protractor 和 Selenium : StaleElementReferenceError: stale element reference: element is not attached to the page document

IOS测试: Test interaction between two apps

loops - Mockito 模拟一个无限循环的方法

javascript - TypeError : result. 推送不起作用

javascript - 使用按位运算符时 "both bits"是什么意思

javascript - 如何在 IE 中散焦下拉菜单? ( Angular )

JavaScript .startsWith() 函数在 IE 中不起作用,在 angularjs 项目中

javascript - 将 AngularJS 从 1.5.0 更新到 1.5.8