Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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:

  • Node 4.2.4
  • NPM 3.5.3
  • Protractor 3.0.0
like image 310
benjovanic Avatar asked Jan 13 '16 15:01

benjovanic


2 Answers

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.

like image 163
benjovanic Avatar answered Nov 14 '22 23:11

benjovanic


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

like image 23
reutsey Avatar answered Nov 15 '22 01:11

reutsey