Protractor test doesn't have test and assertion output and instead just has spec

送分小仙女□ 提交于 2020-01-03 17:04:02

问题


I'm trying to do the tutorial on the Protractor website here https://angular.github.io/protractor/#/

However, my output does not include 1 test, 3 assertions, 0 failures as expected.

Instead it is:

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

Config file:

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

Test file:

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

Versions:

  • Node 4.2.4
  • NPM 3.5.3
  • Protractor 3.0.0

回答1:


I've discovered that this issue is because of the latest version of protractor, v3.0.0.

I installed v2.5.1 and I get x test, x assertion, x failures instead of x specs, x failures now.




回答2:


I like to use the jasmine spec reporter output. You will need to run npm install jasmine-spec-reporter and jasmine-reporters but you can then add this to the protractor conf file and it will give you the it block and if it passed/failed:

More info: https://github.com/bcaudan/jasmine-spec-reporter/blob/master/docs/customize-output.md



来源:https://stackoverflow.com/questions/34771297/protractor-test-doesnt-have-test-and-assertion-output-and-instead-just-has-spec

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!