我正在嘗試爲AngularJS TODO MVC應用程序編寫單元測試,而且我有點卡住學習e2e測試語法。AngularJS e2e用ENTER鍵測試
到目前爲止,這是我有:
describe('todomvc', function() {
beforeEach(function() {
browser().navigateTo('../app/index.html');
});
afterEach(function() {
localStorage.clear();
});
describe('localstorage behavior', function() {
it('should load with zero items in localstorage', function() {
expect(repeater('#todo-list li').count()).toEqual(0);
input('newTodo').enter('Foo Bar');
expect(repeater('#todo-list li').count()).toEqual(1);
});
});
});
而且我的配置:
basePath = '../';
files = [
ANGULAR_SCENARIO,
ANGULAR_SCENARIO_ADAPTER,
'test/e2e/**/*.js'
];
autoWatch = false;
browsers = ['Chrome'];
//singleRun = true;
proxies = {
'/': 'http://localhost:8000/'
};
junitReporter = {
outputFile: 'test_out/e2e.xml',
suite: 'e2e'
};
總之,我需要一種方法來模擬「ENTER」鍵,因爲這是這個TODO MVC如何應用程序將項目添加到列表中。我怎樣才能做到這一點?