javascript - Testing Angular dynamic page content (ng-if) with Geb -


i trying test if angular ng-if element visible or not using geb. far i've attempted test if displayed property true or false follows.

angular:

<article ng-if="!condition" class="bar foo ng-scope">text display</article> 

geb ui module:

unselectederrortext { $(class: "bar foo ng-scope") } 

test:

assertthat(unselectederrortext.displayed).isfalse() checkbox.value()==false assertthat(unselectederrortext.displayed).istrue() 

i getting following error:

the required page content 'unselectederrortext - simplepagecontent' not present 

thanks in advance!

what had missed angular code generates dynamic page content. geb(through underlying selenium) have initial dom before javascript manipulation performed.

i solved using waitfor method provided geb.

checkbox.value(false) waitfor("quick") {     assertthat(unselectederrortext.displayed).istrue() } 

any further, more comprehensive explanation appreciated!


Comments