3

我正在尝试运行 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'。Stacktrace:错误:[object Object] 的期望失败。(/Users/bgowda1/Work/Projects/Demos/protractor-tests/firsttest.js:35:36)

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

HTML 报告仅显示 5 个测试。

4

1 回答 1

5

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

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

于 2015-01-12T20:24:31.457 回答