我是使用量角器进行e2e测试的新手,我最近遇到了一个问题。当我尝试运行我的测试时(这与我在官方量角器网站上发现的基本相同),服务器首先使用Firefox作为默认浏览器。正如我所读,chrome应该是默认使用的。
16:17:24.345 INFO - Executing: [new session: Capabilities [{count=1, browserName=firefox}]])
16:17:24.345 INFO - Creating a new session for Capabilities [{count=1, browserName=firefox}]
16:17:27.305 INFO - Done: [new session: Capabilities [{count=1, browserName=firefox}]]
由于Firefox问题#1734,测试始终失败
Failures:
1) angularjs homepage todo list should add a todo
Message:
timeout: timed out after 36000 msec waiting for spec to complete
Stacktrace:
undefined
Finished in 36.777 seconds
1 test, 1 assertion, 1 failure
所以我添加了chrome作为另一个浏览器用于配置文件
conf.js
exports.config = {
seleniumAddress: 'http://localhost:4444/wd/hub',
capabilities: {
browserName: 'chrome'
},
specs: ['todo-spec.js'],
framework: 'jasmine'
};
这是测试
待办事项-spec.js
describe('angularjs homepage todo list', function() {
it('should add a todo', function() {
browser.get('http://angularjs.org');
element(by.model('todoText')).sendKeys('write a protractor test');
element(by.css('[value="add"]')).click();
var todoList = element.all(by.repeater('todo in todos'));
expect(todoList.count()).toEqual(3);
expect(todoList.get(2).getText()).toEqual('write a protractor test');
});
});
但它仍然无效。我在这做错了什么?
感谢您的帮助!