Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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

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"]);
    });
like image 569
Pete_ch Avatar asked Nov 03 '12 20:11

Pete_ch


People also ask

What is Jasmine framework in protractor?

Jasmine is a test framework, which provides BDD (Behavior Driven Development) functionalities for your automation framework. It is an independent framework i.e there is no dependency with other framework and doesn't require DOM. A describe-block, it-block, and an expectation with matcher makes one complete test script.

What is protractor automation tool?

What is Protractor? Protractor is an open-source automation testing framework that is written using NodeJS. It offers combined end to end testing for web applications that are built using AngularJS. It supports both Angular and Non-Angular applications.

What is protractor angular?

Protractor is an end-to-end test framework for Angular and AngularJS applications. Protractor runs tests against your application running in a real browser, interacting with it as a user would.


1 Answers

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.

like image 194
pkozlowski.opensource Avatar answered Nov 08 '22 20:11

pkozlowski.opensource