Currently, I am in the process of developing an application using angularJS and testing it with protractor.
My main issue lies in verifying the value within an input field. Here is the specific input code:
<input id="rank-max-range" class="form-control has-feedback" name="inputMax" type="number" placeholder="Maximum" ng-model="selectedItem.range.max" min="{{selectedItem.range.min}}" max="{{selectedItem.answers.length}}">
Below is the test script that I'm trying to execute:
it('should fill the max range with the given value', function() {
element(by.id('rank-max-range')).sendKeys(2);
expect(element(by.id('rank-max-range')).getText()).toEqual(2);
});
However, this test is not functioning as expected. After consulting the documentation, I learned about the getAttribute('value')
method. But unfortunately, my input does not have a value attribute.
I am curious if there is a way to validate the content of the ng-model
, but so far, I have not found a solution.
If you have any suggestions on how I could successfully run this test, I would greatly appreciate your insight.