gsklee / ngStorage

localStorage and sessionStorage done right for AngularJS.
MIT License
2.34k stars 461 forks source link

Protractor fails on pending: - $timeout #246

Open azachar opened 7 years ago

azachar commented 7 years ago

Hi There, I am experiencing a weird behaviour of ngStorage. Actually browser.waitForAngular() fails on this exception:

The following tasks were pending: -
$timeout: function() {
    var temp$storage;
    _debounce = null;
    if (!angular.equals($storage, _last$storage)) {
        temp$storage = angular.copy(_last$storage);
        angular.forEach($storage, function(v, k) {
            if (angular.isDefined(v) && '$' !== k[0]) {
                webStorage.setItem(storageKeyPrefix + k, serializer(v));
                delete temp$storage[k];
            }
        });
        for (var k in temp$storage) {
            webStorage.removeItem(storageKeyPrefix + k);
        }
        _last$storage = angular.copy($storage);
    }
} - $timeout: function() {
    var temp$storage;
    _debounce = null;
    if (!angular.equals($storage, _last$storage)) {
        temp$storage = angular.copy(_last$storage);
        angular.forEach($storage, function(v, k) {
            if (angular.isDefined(v) && '$' !== k[0]) {
                webStorage.setItem(storageKeyPrefix + k, serializer(v));
                delete temp$storage[k];
            }
        });
        for (var k in temp$storage) {
            webStorage.removeItem(storageKeyPrefix + k);
        }
        _last$storage = angular.copy($storage);
    }
}

Do you have any idea why this is happening?

Thanks a lot!

Cheers, A.

azachar commented 7 years ago

Well, actually I just create a fork where instead of $timeout is $interval used. Replacing $timeout with setTimeout did not help. Have a look at https://github.com/azachar/ngStorage-mock

fabianclain commented 6 years ago

hey @azachar did you find any workaround for this?

does the fork work for you ? with your fork seems like I am getting stuck in the exact same point, however, without the $timeout error..

azachar commented 6 years ago

I am using that fork and it seems to be a rock solid so far.