量角器-html-屏幕截图-报告器未显示报告器文件中执行的所有测试

protractor-html-screenshot-reporter not showing all the tests executed in the reporter file

本文关键字:报告 执行 测试 显示 屏幕截图 -html- 量角器 文件      更新时间:2023-09-26

我试图运行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'
    }));
  }
}

控制台操作:

失败:

1)Angularjs主页应添加四条和六条消息: 预期"0"等于"10"。 堆栈跟踪: 错误:预期失败 在 [对象对象]。(/users/bgowda1/Work/Projects/Demos/protractor-tests/firsttest.js:35:36)

在 6.191 秒内完成 6 次测试,6 次断言,1 次失败

HTML 报告仅显示 5 个测试。

我能够重现它 - 这始终是最终 HTML 报告中缺少的最新it块。这应该报告给量角器-html-屏幕截图-报告器错误跟踪器。

作为当前的解决方法,降级到量角器 1.4.0(经过测试,对我有用)。或者,在文件末尾添加一个空的it()块。如果我能提出修复或更好的解决方法,我会更新帖子。