2015-02-23 95 views
1

我試圖運行自述文件中的示例:我不能量角器-PERF運行測試例子

var ProtractorPerf = require('protractor-perf'); 
describe('angularjs homepage todo list', function() { 
    var perf = new ProtractorPerf(protractor, browser); // Initialize the perf runner 
    it('should add a todo', function() { 
     browser.get('http://www.angularjs.org'); 

     perf.start(); // Start measuring the metrics 
     element(by.model('todoText')).sendKeys('write a protractor test'); 
     element(by.css('[value="add"]')).click(); 
     perf.stop(); // Stop measuring the metrics 

     if (perf.isEnabled) { // Is perf measuring enabled ? 
      // Check for perf regressions, just like you check for functional regressions 
      expect(perf.getStats('meanFrameTime')).toBeLessThan(60); 
     }; 

     var todoList = element.all(by.repeater('todo in todos')); 
     expect(todoList.count()).toEqual(3); 
    }); 
}); 

我用量角器預代替量角器,什麼我後見:

1) angularjs homepage todo list should add a todo: 
    TypeError: undefined is not a function 
     at Context.<anonymous> (E:\dashboard-perf.spec.js:41:34 
) 
     at C:\Users\ky\AppData\Roaming\npm\node_modules\protractor\node_modules\se 
lenium-webdriver\testing\index.js:121:22 
     at [object Object].webdriver.promise.ControlFlow.runInNewFrame_ 

所以它是關於行:

41   expect(todoList.count()).toEqual(3); 

什麼是我的配置問題?或者是什麼?

+0

它會在哪一行發生錯誤?請提供完整的追溯。 – alecxe 2015-02-23 13:31:53

+0

@alecxe感謝您的快速響應,請參閱更新 – kyxap 2015-02-23 13:44:11

回答

相關問題