I need some advice with issue below. When checkbox = checked, there will be attribute value checked=checked and for the unchecks, attribute will not be there and I can't uniquely identify. On a page, there will be checked and unchecked checkboxes. Dev refuses to add additional attribute for me and saying that there must be a way to identify (exist or not exist).
So on my my test page, I have 10 checkboxes with 3 checked and 7 unchecked.
HTML for uncheck checkboxes
<input type="checkbox" disabled="disabled" ng-checked="item.unread">
HTML for checked checkboxes
<input type="checkbox" disabled="disabled" ng-checked="item.unread" checked="checked">
My attempt at counting - it will returned exact number and will fail eventually as number may change.
expect(element.all(by.css('input[checked="checked"]')).count()).toBe(2);
No issue with identifying checked items with attribute - checked="checked"
expect(element.all(by.css('input[checked="checked"]')).isSelected()).toBeTruthy();
but fails when I check for unchecked item.
expect(element.all(by.css('input[type="checkbox"]')).isSelected()).toBeFalsy();
Failed result for unchecked item - 7 unchecked and 3 checked
[ false false false false true true false false true false]
Thanks
Aucun commentaire:
Enregistrer un commentaire