I went in and created id tags for each dropdown. I tried creating a loop to select each manufacturer in the drop down without having to write 300+ lines of code since there are many options in some of the dropdowns. I tried and couldn't figure out a way. The second drop down for example is "source_manufacturer".
This is what i tried:
var expected = ['COMFORT-AIRE', 'Daewoo', 'GE'];
var els = element.all(by.id('source_manufacturer'));
for (var i = 0; i < expected.length; ++i) {
expect(els.get(i).getText()).toEqual(expected[i]);
}
Here is the html code:
<select id="source_manufacturer" ng-class="{'btn btn-default' : !$root.isMobile.iOS()}" class="form-control ng-valid btn btn-default ng-not-empty ng-touched ng-dirty ng-valid-parse" ng-model="manufacturer" ng-options="m.name for m in manufacturers">
`<option selected="selected" value="object:439" label="COMFORT-AIRE">COMFORT-AIRE</option>
....
<option value="object:443" label="Whirlpool">Whirlpool</option></select>`
This is the error message: Failed: Index out of bound. Trying to access element at index: 1, but there are only 1 elements that match locator By(css selector, *[id="source_manufacturer"]). I want to test if each one can be selected and that it actually changes.
The expected shows every element in the list instead of a single one.
This is how i would go about clicking each individual element in the list:
element(by.id('source_manufacturer')).click().
element(by.cssContainingText('option', 'GE')).click();