Reputation: 1059
I'm testing a simple checkbox that displays a pop up when checked. When I run my e2e test I see the pop up is being displayed after the checkbox gets checked. The result of the test however is false. Why does the isPresent()
function return false? Is there some kind of delay?
This is the code of my e2e test:
it('should display popup window if button is checked', function () {
var popUp = element(by.binding('who.othersIncluded'));
element(by.id('othersIncl')).click();
expect(popUp.isPresent()).toBeTruthy();
});
This is the html:
<input id="othersIncl" class="input-checkbox-alt" type="checkbox" data-ng-model="who.othersIncluded" data-ng-change="update()"/>
<div data-ng-show="who.othersIncluded">
<div>hidden popup</div>
</div>
Upvotes: 1
Views: 1117
Reputation: 1059
Found a way to make it work!
This is the working code to select the html div with the ng-show attribute:
popUp = $('[data-ng-show="who.othersIncluded"]');
This returns an element that can be used in the expectation.
Upvotes: 1