So, I am doing an e2e test with protractor and angular,
My first test was adding an item to the list,
Now I am trying to remove it, and I am having problems with this.
So here is what I need to do:
- Find the name of the record I want to delete
- click on the trash can icon of the same line and delete it
- click ok in the popup that appears
- Try to avoid using By.css as much as possible and prefer everything related to angular (byBinding, model, etc.). This is due to the fact that this part of the application changes over time, so I will have to redo all these cases.
HTML:
...
<div class="list-group-item ng-scope" ng-repeat="item in teamList">
<span class="glyphicon glyphicon-user"></span>
<span ng-bind="item.name" class="memberName ng-binding">nuevo Team</span>
<a ng-click="editTeam(item._id)" class="hand-cursor">
<span class="glyphicon glyphicon-edit memberRemoveBotton"></span>
</a>
<a ng-confirm-click="Would you like to delete this item?" confirmed-click="deleteTeam(item._id)" class="hand-cursor">
<span class="glyphicon glyphicon-trash memberRemoveBotton"></span>
</a>
</div>
JS:
describe('Testing delete Item',function() {
it('Should delete the Item that just got Inserted',function() {
element(by.css('a[href="#!/item-create"]')).click();
element.all(by.repeater('item in itemList')).then(function(table) {
table.element(by.binding('item.name')).each(function(names) {
console.log('the names',names.getText());
});
});
});
});
Any tips on how to solve this are appreciated.