量角器找到ng-repeat元素

时间:2015-10-09 21:07:57

标签: angularjs angularjs-ng-repeat protractor

我的ng-repeat语法为

    ng-repeat="(occupancy_category, singleCardCategoryData) in categoryCardServiceResponse | orderBy: 'occupancy_category'"

我想使用protractor来编写测试并对卡进行计数但由于某种原因无法找到它。这就是我认为错误"Expected 0 to be 6"的意思。这是我的测试块

  it('should check number of category status cards', function(){
     var categoryCards = element.all(by.repeater('(occupancy_category, singleCardCategoryData) in categoryCardServiceResponse | orderBy: occupancy_category'));

     expect(browser.getCurrentUrl()).toEqual('http://localhost:8000/app/#/dashboard');
     expect(categoryCards.count()).toBe(6)
 });

1 个答案:

答案 0 :(得分:1)

从测试中删除此部件将起作用

orderBy: occupancy_category

所以新代码看起来像

var categoryCards = element.all(by.repeater('(occupancy_category, singleCardCategoryData) in categoryCardServiceResponse'));