我正在尝试从自述文件中运行示例:
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 :(得分:2)
The UI in protractor's example has different IDs now. You can run the sample from the test directory here - https://github.com/axemclion/protractor-perf/blob/master/test/example.spec.js.
I have also updated the README example.