benjovanic
benjovanic

Reputation: 537

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

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:

Upvotes: 5

Views: 4508

Answers (2)

benjovanic
benjovanic

Reputation: 537

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.

Upvotes: 5

reutsey
reutsey

Reputation: 1993

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:

enter image description here

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

Upvotes: 3

Related Questions