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"]);
});
The
repeateris not a Jasmine construct, it is AngularJS e2e scenario tester concept.The
repeaterfunction 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#L249The 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
ngScenariorunner 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
repeateris 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 thengRepeatdirective.