How can I address dynamically added form fields from an AngularJS / Karma e2e test? Which selector can I use to target these?
I will use the AngularJS form example as a reference.
While the static form fields, like
<input type="text" ng-model="form.name" required/>
can be targeted like
input('form.name').enter('change');
how would I target the dynamically added fields? I refer to the fields added by clicking "add" in this section:
<label>Contacts:</label>
[ <a href="" ng-click="addContact()">add</a> ]
<div ng-repeat="contact in form.contacts">
<select ng-model="contact.type">
<option>email</option>
<option>phone</option>
<option>pager</option>
<option>IM</option>
</select>
<input type="text" ng-model="contact.value" required/>
[ <a href="" ng-click="removeContact(contact)">X</a> ]
</div>
EDIT: Entering the first contact details is straightforward. Simulating the click on addContact is straightforward. But how do I enter the next contact details, in the added fields? I can't really use the same selector again... The following changes both contact.value
input('contact.value').enter('abc@mail.com');