I'm in the need to assert the number of the children .row
of a series of divs .container
is greater than 0.
this.Then(/^I should see at least one element in each container$/, function (done) {
page.element.all(by.css('.container'))
.each(function (element, index) {
element.all(by.css('.row'))
.then(function(elements) {
expect(elements.length).to.be.greaterThan(0);
done();
});
});
});
The markup looks like:
<div class="container">
<div class="row"></div>
<div class="row"></div>
<div class="row"></div>
</div>
<div class="container">
<div class="row"></div>
</div>
and there must be at least one .row
in each container.
The problem is that it always passes, as soon as the first checks true.
I've tried different solutions using protractor.promise
object, also trying to save the promise within the each
iteration and then trying to do the expectation at the end but nothing really worked.
I've started thinking that I should take this approach from a completely different perspective.
Any takers?