More Than Five
More Than Five

Reputation: 10419

How to see what Protractor tests is currently executing?

In my Protractor test script, I use the usual notation:

describe("mytest") {
    ...
    it(" should do this") {
    ... 
    it(" should do that") {

I would like to be able to see what test and what part of each is currently running when I run them. Is there any option I can use to output test descriptions to the console?

Upvotes: 18

Views: 11884

Answers (5)

Svetozar Misljencevic
Svetozar Misljencevic

Reputation: 736

There is a reporter that should do what you are looking for. Take a look at https://www.npmjs.com/package/jasmine-spec-reporter and https://github.com/bcaudan/jasmine-spec-reporter/tree/master/examples/protractor

Upvotes: 14

rafalf
rafalf

Reputation: 435

        console.log('\nTest spec: ' + __filename + '\n');

to log the test but no idea how to log the it being executed

Upvotes: 0

vrachlin
vrachlin

Reputation: 817

If you need to know the name of the spec currently rinning you could use: jasmine.getEnv().currentSpec.description and log it

Upvotes: 0

asherrard
asherrard

Reputation: 683

since protractor runs in node you can use console.log as you normally would in javascript, for more console fun see the node docs

I like to place any logs after functionality so that I know its been completed, so wrapping it inside of a .then() function seemed to work best for me

example:

element(elementToFind).click().then(function(){
    console.log("clicked element");
    continue();
});

Upvotes: 0

Andres D
Andres D

Reputation: 8900

You can use the --verbose option to print more information about your tests, but it will not tell you which test is currently being run.

I suggest you to create an issue if you want that feature. https://github.com/angular/protractor/issues/new

$ ./node_modules/protractor/bin/protractor protractor-config.js --verbose

------------------------------------
PID: 7985 (capability: chrome #1)
------------------------------------

Using the selenium server at http://localhost:4444/wd/hub

angularjs homepage
    should greet the named user

    todo list
        should list todos
        should add a todo

Finished in 5.915 seconds
3 tests, 5 assertions, 0 failures

Upvotes: 13

Related Questions