mardi 31 mai 2016

How to check checkbox in repeater with protractor

I am having difficulty checking a checkbox in an AngularJs repeater with protractor.

The model looks like this:

environments: [
                {
                    name: 'Proof of Concept',
                    checked: false
                },
                {
                    name: 'Non-Production',
                    checked: false
                },
                {
                    name: 'Production',
                    checked: false
                }
            ]

The view like this:

<div class="checkbox" ng-repeat="environment in vm.assessment.environments">
  <label><input type="checkbox" ng-model="vm.assessment.environments[$index].checked" ng-click="vm.checkboxChanged()" ng-required="!vm.someChecked"></label>


</div>

Am getting the repeater in protractor like so:

this.environments = element.all(by.repeater('environment in vm.assessment.environments'));

And trying to check the checkbox like this but when i run the test it does not seem to check it:

this.environments.get(0).click();

Aucun commentaire:

Enregistrer un commentaire