jeudi 4 juin 2015

How to create a wait function in AngularJS Karma - Jasmine Testing

Instead of using browser.waitForAngular(), is there any other ways to make a delay or wait for the previous function to finish execute before proceed to next line? (because it create a lot of problems, example: "ReferenceError:browser is not defined", "window.angular.$$csp is not a function" of angular.js)

describe('Popup', function(){
            it("Should close on second click", function(){
                compileDirective(400,'click','true');  
                element.triggerHandler('click');
                waitttttttt(1000); // Wait function here before proceed to next line
                element.triggerHandler('click');
                scope.$digest();
                timeout.flush();
                expect($('.sidepopright').length).toBe(0);
                element.remove();
                $(".sidepopright").remove();
            });
      });

This is my previous question:: Is there any wait() function for AngularJS Jasmine test?, But no solution. Anyone can help?

Aucun commentaire:

Enregistrer un commentaire