我正在量角器中编写一个非常简单的测试规范来了解框架的要点。在我尝试测试服务之前一切正常。通常我会打电话inject
来获取依赖关系,但现在我得到了inject is not defined
错误。这是我的测试规范的代码:
function SingleModelPage() {
this.getDataList = function() {
return element.all(by.repeater('d in data'));
};
this.get = function() {
browser.get('http://localhost:8080/');
element(by.css('#ln-single-model')).click();
};
}
describe('Single Model Page', function() {
var page = new SingleModelPage();
var dataService;
beforeEach(function() {
page.get();
});
// I tried to add mock module but angular is not defined as well, so
// I couldn't call angular.module
beforeEach(inject(function(SingleModelDataService) {
dataService = SingleModelDataService;
}));
describe('Testing Setup', function() {
it('should load the single model page by default', function() {
expect(page.getDataList().count()).toEqual(1);
});
});
describe('Single Model Service', function() {
it('should contain single model data service', function() {
//expect(dataService).not.toEqual(null);
});
});
});