简体   繁体   English

量角器by.repeater命令中是否有错误

[英]Is there a bug in Protractor by.repeater command

I start to use Protractor from few days. 我从几天开始使用量角器。 But by.repeater function seems to show pass test for every ng-repeat element even though that binding name is wrong. 但是by.repeater函数似乎为每个ng-repeat元素显示通过测试,即使该绑定名称错误。 here is the examples gives in protractor tutorial page http://angular.github.io/protractor/#/tutorial 这是量角器教程页面http://angular.github.io/protractor/#/tutorial中给出的示例

 // spec.js
describe('angularjs homepage', function() {    
 var firstNumber = element(by.model('first'));    
  var secondNumber = element(by.model('second'));    
  var goButton = element(by.id('gobutton'));    
  var latestResult = element(by.binding('latest'));    

var history = element.all(by.repeater('result in memory')); var history = element.all(by.repeater('result in memory'));

  function add(a, b) {    
    firstNumber.sendKeys(a);    
    secondNumber.sendKeys(b);    
    goButton.click();
  }

  beforeEach(function() {
    browser.get('http://juliemr.github.io/protractor-demo/');
  });

  it('should have a history', function() {
    add(1, 2);
    add(3, 4);

    expect(history.count()).toEqual(2);

    add(5, 6);

    expect(history.count()).toEqual(3); // This is wrong!
  });
});

but even though I change the code it gives test pass 但是即使我更改了代码,它也可以通过测试

 // spec.js
describe('angularjs homepage', function() {
  var firstNumber = element(by.model('first'));
  var secondNumber = element(by.model('second'));
  var goButton = element(by.id('gobutton'));
  var latestResult = element(by.binding('latest'));

var history = element.all(by.repeater('result in me')); var history = element.all(by.repeater('result in me'));

  function add(a, b) {
    firstNumber.sendKeys(a);
    secondNumber.sendKeys(b);
    goButton.click();
  }

  beforeEach(function() {
    browser.get('http://juliemr.github.io/protractor-demo/');
  });

  it('should have a history', function() {
    add(1, 2);
    add(3, 4);

    expect(history.count()).toEqual(2);

    add(5, 6);

    expect(history.count()).toEqual(3); // This is wrong!
  });
});

I don't know whether I am trying to use it 我不知道我是否要使用它

I found the answer. 我找到了答案。 it is a bug in Protractor. 这是量角器中的错误。 The problem is Protractor check whether 问题是量角器检查是否

result in me 结果我

is in (with indexOf command) a string with ng-repeat but not check whether it is equal to it. 在(使用indexOf命令)包含ng-repeat的字符串中,但不检查它是否等于它。

So it pass the test cases with "result in me" , "result in memory" but not "result in memorys" 因此它以“ result in me”,“ result in memory”而不是“ result in memory”通过了测试用例

I think it has to be fixed 我认为必须修复

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM