Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

AngularJS Protractor: Step-by-step progress logs

In the (now deprecated) angular scenario test runner, there was an option to create a runner.html page that would run the tests in an iFrame while reporting the progress, step-by-step, in the main page.

Screenshot of scenario runner

Is there any way to get a similar step-by-step log for protractor tests? It does not need to be in an html page (console or log file would be fine).

like image 971
Ryan Gross Avatar asked Jul 14 '14 14:07

Ryan Gross


People also ask

How do I print a log in Protractor?

log(timeText); // outputs the actual text console. log(pageTitleInnerHtml); //outputs the text of the Inner html });

Why Protractor is deprecated?

The development team behind Protractor decided that more modern testing software can better serve their users. This is mainly because, in order for Protractor to update to its fullest potential, users would have to rewrite all their tests.

How do you run a single test case on a Protractor?

describe('Login page', function() { beforeEach(function() { browser. ignoreSynchronization = true; ptor = protractor. getInstance(); }); it('should contain navigation items', function(){ //test case code here }); it('should login the user successfully', function(){ //test case code here }) });

What does spec file mean in Protractor?

What is Spec File in Protractor? Spec File contains the specs or automated test cases commonly termed as a Test Scripts File. Protractor tests are written using the syntax of the test framework. In this tutorial, we will be using Jasmine Test Framework. It is simple and easy to understand and most widely used.


2 Answers

For that you can use the jasmine-spec-reporter for protractor. You'll have a visual feedback of all your passing and non-passing tests :

enter image description here

Easy to configure and looks really good in the console.

Hope this helps.

like image 135
Jscti Avatar answered Sep 19 '22 16:09

Jscti


Since v1.0.0-rc2 you can see failures in real time:

In your protractor config, add a jasmineNodeOpts object with realtimeFailure option to true:

exports.config = {
  seleniumAddress: 'http://127.0.0.1:4444/wd/hub',

  specs: [
    'e2e/**/*.js'
  ],

  multiCapabilities: [
    {'browserName': 'firefox'},
    {'browserName': 'chrome'}
  ],

  baseUrl: 'http://localhost:8000',

  onPrepare: function() {},

  jasmineNodeOpts: {
    realtimeFailure: true
  }
};

The full list of jasmine options is here: minijasminenode

And the well detailed reference config file for protractor here: referenceConf.js

like image 45
glepretre Avatar answered Sep 22 '22 16:09

glepretre