【发布时间】:2014-05-10 16:15:44
【问题描述】:
我正在使用 Jasmine 为 AngularJS 编写端到端测试。我正在使用量角器来运行测试。我有以下标记
<ul class="phone-thumbs">
<li ng-repeat="img in phone.images">
<img ng-src="{{img}}">
</li>
</ul>
我想测试一个特定的页面实例,我有四个这样的图像。这是我目前所拥有的
describe('Phone detail view', function() {
beforeEach(function() {
browser.get('app/index.html#/phones/nexus-s');
});
it('should display four thumbnails on the nexus-s page', function() {
expect(element(by.css('.phone-thumbs li img')).length()).toBe(4);
});
});
问题是我收到一个错误提示
TypeError: Object #<Object> has no method 'length'
我哪里出错了?
【问题讨论】:
标签: javascript jquery angularjs jasmine protractor