我正在尝试在Protractor网站https://angular.github.io/protractor/#/
上进行教程但是,我的输出未按预期包含1 test, 3 assertions, 0 failures
。
取而代之的是:
Using the selenium server at http://localhost:4444/wd/hub
[launcher] Running 1 instances of WebDriver
Started
.
1 spec, 0 failures
Finished in 12.273 seconds
[launcher] 0 instance(s) of WebDriver still running
[launcher] chrome #1 passed
配置文件:
exports.config = {
seleniumAddress: 'http://localhost:4444/wd/hub',
specs: ['todo-spec.js']
};
测试文件:
describe('angularjs homepage todo list', function() {
it('should add a todo', function() {
browser.get('https://angularjs.org');
element(by.model('todoList.todoText')).sendKeys('write first protractor test');
element(by.css('[value="add"]')).click();
var todoList = element.all(by.repeater('todo in todoList.todos'));
expect(todoList.count()).toEqual(3);
expect(todoList.get(2).getText()).toEqual('write first protractor test');
// You wrote your first test, cross it off the list
todoList.get(2).element(by.css('input')).click();
var completedAmount = element.all(by.css('.done-true'));
expect(completedAmount.count()).toEqual(2);
});
});
版本:
答案 0 :(得分:3)
我发现这个问题是因为最新版本的量角器v3.0.0。
我安装了v2.5.1,现在我获得x test, x assertion, x failures
而不是x specs, x failures
。
答案 1 :(得分:2)
我喜欢使用jasmine spec报告输出。你需要运行npm install jasmine-spec-reporter和jasmine-reporter,但你可以将它添加到量角器conf文件中,它会给你块,如果它通过/失败了:
更多信息:https://github.com/bcaudan/jasmine-spec-reporter/blob/master/docs/customize-output.md