我不能 运行 protractor-perf 的测试示例
I can't run the test example with protractor-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);
});
});
我使用的是 Protractor-pre 而不是量角器,之后我看到的是:
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);
我的配置有什么问题?或者那是什么?
量角器示例中的UI现在有不同的ID。您可以在此处 运行 测试目录中的样本 - https://github.com/axemclion/protractor-perf/blob/master/test/example.spec.js.
我还更新了 README 示例。
我正在尝试 运行 自述文件中的示例:
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);
});
});
我使用的是 Protractor-pre 而不是量角器,之后我看到的是:
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);
我的配置有什么问题?或者那是什么?
量角器示例中的UI现在有不同的ID。您可以在此处 运行 测试目录中的样本 - https://github.com/axemclion/protractor-perf/blob/master/test/example.spec.js.
我还更新了 README 示例。