Is 'repeater' in this angular tutorial a jasmine concept?

All we need is an easy explanation of the problem, so here it is.

Looking through angular js tutorial, I do not understand where the repeater (function?) comes from in a jasmine test. Is this a jasmine or an angular construct?

The page does have an ng-repeat attribute in a <li> element – but I dont see how that translates to the reference to ‘repeater’ in the test

  it('should be possible to control phone order via the drop down select box',
    function() {
    //let's narrow the dataset to make the test assertions shorter
    input('query').enter('tablet');

    //where does  'repeater' below come from?
    expect(repeater('.phones li', 'Phone List').column('phone.name')).
    toEqual(["Motorola XOOM\u2122 with Wi-Fi",
    "MOTOROLA XOOM\u2122"]);

    select('orderProp').option('Alphabetical');


    expect(repeater('.phones li', 'Phone List').column('phone.name')).
    toEqual(["MOTOROLA XOOM\u2122",
    "Motorola XOOM\u2122 with Wi-Fi"]);
    });

How to solve :

I know you bored from this bug, So we are here to help you! Take a deep breath and look at the explanation of your problem. We have many solutions to this problem, But we recommend you to use the first method because it is tested & true method that will 100% work for you.

Method 1

The repeater is not a Jasmine construct, it is AngularJS e2e scenario tester concept.

The repeater function is defined in the DSL used by the AngularJS e2e scenario runner and its definition can be seen here: https://github.com/angular/angular.js/blob/master/src/ngScenario/dsl.js#L249
The corresponding documentation is located at: http://docs.angularjs.org/guide/dev_guide.e2e-testing

It should be noted that even if AngularJS uses Jasmine syntax for its end-to-end test, those e2e tests are not Jasmine tests, they just happen to use very similar syntax. The purpose of the AngularJS ngScenario runner is to execute end-to-end tests in a browser and uses matchers are tight to the browser environment (DOM, location etc.) Jasmine is more focused on unit-tests and has matchers for JavaScript objects.

The mentioned repeater is just a way of counting DOM object given a jQuery selector and it is true that is usually used to count DOM element produced by the ngRepeat directive.

Note: Use and implement method 1 because this method fully tested our system.
Thank you 🙂

All methods was sourced from stackoverflow.com or stackexchange.com, is licensed under cc by-sa 2.5, cc by-sa 3.0 and cc by-sa 4.0

Leave a Reply