小编koo*_*nix的帖子

等待范围评估量角器

考虑这个简单的量角器测试:

<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"加载到范围内?

谢谢

angularjs protractor

3
推荐指数
1
解决办法
2511
查看次数

标签 统计

angularjs ×1

protractor ×1