unit testing - Is there any wait() function for AngularJS Jasmine test? -


i created popup, open on first click , close on second click. however, faced problem when testing. second click doesn't close popup. , found out problem because during first click popup haven't appeared in screen yet, that's why second click doesn't close popup. so, decide put delay between clicks. idea on how implement delay?

describe('popup', function(){             it("should close on second click", function(){                 compiledirective(400,'click','true');                   element.triggerhandler('click');                 waitttttttt(1000); // wait function here before proceed next line                 element.triggerhandler('click');                 scope.$digest();                 timeout.flush();                 expect($('.sidepopright').length).tobe(0);                 element.remove();                 $(".sidepopright").remove();             });       }); 

what need browser.waitforangular();

describe('popup', function(){             it("should close on second click", function(){                 compiledirective(400,'click','true');                   element.triggerhandler('click');                 browser.waitforangular(); // wait function here before proceed next line                 element.triggerhandler('click');                 scope.$digest();                 timeout.flush();                 expect($('.sidepopright').length).tobe(0);                 element.remove();                 $(".sidepopright").remove();             });       }); 

browser.waitforangular(); wait till gets full response front


Comments

Popular posts from this blog

javascript - Bootstrap Popover: iOS Safari strange behaviour -

Website Login Issue developed in magento -

Can the constants be defined inside a model file of a framework in PHP? -