angularjs - Waiting for element by.css() in protractor -


i have code in $scope.$broadcast triggers event executes element.addclass()

code in controller

ctrlr.rolldice = function(){  .... stuff   $scope.$broadcast('eventtype', args); } 

code in directive

scope.$on('eventtype', function(){ element.addclass('class'); }); 

i trying wait until event has fired , element.addclass executed in protractor test using

browser.wait(element(by.css('.activate')).ispresent,15000).then(function(ispresent){       expect(ispresent).tobe(true);     }); 

however, following error

typeerror: cannot read property 'getwebelements' of undefined

how wait element class .activate show up ??

note element can random visible element ...it set class. if run project in actual web browser....everything runs successfully.

try this:

browser.wait(() => $('.activate')).ispresent() ,15000); expect($('.activate').ispresent()).tobe(true); 

or es5 version

browser.wait(function() {   return $('.activate').ispresent(); }, 15000); expect($('.activate').ispresent()).tobe(true); 

note: element(by.css('.abc')) === $('.abc')


Comments

Popular posts from this blog

ios - RestKit 0.20 — CoreData: error: Failed to call designated initializer on NSManagedObject class (again) -

laravel - PDOException in Connector.php line 55: SQLSTATE[HY000] [1045] Access denied for user 'root'@'localhost' (using password: YES) -

java - Digest auth with Spring Security using javaconfig -