【问题标题】:Protractor test doesn't have test and assertion output and instead just has spec量角器测试没有测试和断言输出,而是只有规范
【发布时间】:2016-04-18 16:47:03
【问题描述】:

我正在尝试在 Protractor 网站上做教程https://angular.github.io/protractor/#/

但是,我的输出没有像预期的那样包含1 test, 3 assertions, 0 failures

而是:

Using the selenium server at http://localhost:4444/wd/hub
[launcher] Running 1 instances of WebDriver
Started
.


1 spec, 0 failures
Finished in 12.273 seconds
[launcher] 0 instance(s) of WebDriver still running
[launcher] chrome #1 passed

配置文件:

exports.config = {
  seleniumAddress: 'http://localhost:4444/wd/hub',
  specs: ['todo-spec.js']
};

测试文件:

describe('angularjs homepage todo list', function() {
  it('should add a todo', function() {
    browser.get('https://angularjs.org');

    element(by.model('todoList.todoText')).sendKeys('write first protractor test');
    element(by.css('[value="add"]')).click();

    var todoList = element.all(by.repeater('todo in todoList.todos'));
    expect(todoList.count()).toEqual(3);
    expect(todoList.get(2).getText()).toEqual('write first protractor test');

    // You wrote your first test, cross it off the list
    todoList.get(2).element(by.css('input')).click();
    var completedAmount = element.all(by.css('.done-true'));
    expect(completedAmount.count()).toEqual(2);
  });
});

版本:

  • 节点 4.2.4
  • NPM 3.5.3
  • 量角器 3.0.0

【问题讨论】:

    标签: angularjs node.js selenium protractor


    【解决方案1】:

    我发现这个问题是由于最新版本的量角器 v3.0.0.

    我安装了 v2.5.1,现在得到的是 x test, x assertion, x failures 而不是 x specs, x failures

    【讨论】:

      【解决方案2】:

      我喜欢使用 jasmine 规格报告器输出。您将需要运行 npm install jasmine-spec-reporter 和 jasmine-reporters 但您可以将其添加到量角器 conf 文件中,它会为您提供 it 块以及它是否通过/失败:

      更多信息:https://github.com/bcaudan/jasmine-spec-reporter/blob/master/docs/customize-output.md

      【讨论】:

      猜你喜欢
      • 2021-08-25
      • 2019-04-01
      • 2015-10-12
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多