考虑这个简单的量角器测试:
<body>
<div ng-app="test2App" ng-controller="test2Ctrl">
<input ng-model="myValue">
</div>
</body>
var test2App = angular.module('test2App', [])
test2App.controller('test2Ctrl', function($scope,$timeout) {
$timeout(function() {
$scope.myValue = true;
},10000);
});
describe('my suite',function() {
it('wait for a model to be defined',function() {
element(by.model('myValue')).evaluate('myValue')
.then(function(v) {
expect(v).toBe(true);
});
});
});
Run Code Online (Sandbox Code Playgroud)
有没有比量角器sleep()函数更好的方法来等待"myValue"加载到范围内?
谢谢