Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Has anyone found a way to add list numbering to Protractor Describe blocks?

I have a very large number of Describe blocks in my Protractor tests. I get pages and pages of test output all correctly indented but it's difficult to see which test is which and how far the tests have progressed.

Has anyone tried to add a list numbering to the Describe. Something like this:

1.   Main Page test
   1.1  Test xxx
   1.2  Test yyy
      1.2.1 Describe in describe in describe test
2.   XXX Page test
   2.1  Test abc

Note that here the first and maybe second number after dots would be a result of describes with describes.

like image 342
Samantha J T Star Avatar asked Oct 20 '14 09:10

Samantha J T Star


People also ask

Does Protractor support Angular 10?

Protractor works with AngularJS versions greater than 1.0. 6/1.1. 4, and is compatible with Angular applications. Note that for Angular apps, the binding and model locators are not supported.

What is describe and it in protractor?

As mentioned above, Spec file in protractor is kind of a feature file in BDD, Describe-block is a feature in the feature file. Describe is a function in jasmine it takes two parameters namely a string and a function. The first parameter is a string which can be the name of your Collection of Specs or a Feature.

How do you write a protractor code?

Files required by Protractor The test code is written by using the syntax of our testing framework. For example, if we are using Jasmine framework, then the test code will be written by using the syntax of Jasmine. This file will contain all the functional flows and assertions of the test.


Video Answer


1 Answers

You can use jasmine spec reporter (>= 1.1.0) with the displaySuiteNumber option to display the output of your protractor tests.

Output example:

1 first suite
  ✗ should failed
    - Expected true to be false.
  ✓ should be ok

2 second suite
  ✗ should failed
    - Expected true to be false.
  ✓ should be ok

  2.1 first child suite

    2.1.1 first grandchild suite
      ✗ should failed
        - Expected true to be false.
        - Expected true to be false.
      ✗ should failed
        - Expected true to be false.
      ✓ should be ok
like image 77
Bastien Caudan Avatar answered Oct 07 '22 06:10

Bastien Caudan