Request a feature
Error when type in a Input with type="STRING"
Write in a input type STRING instead of type text or textarea
Cypress code
cy.get('div#content > form > md-card > md-card-content > div:nth-child(4) > md-input-container > input').first().type('Recurso1')
HTML label
<input ng-model="properties[attribute.id]" name="0" id="0" min="" max="" ng-required="true" ng-if="isAdding" aria-label="atributo0001" class="ng-pristine ng-untouched ng-scope md-input ng-invalid ng-invalid-required" required="required" aria-required="true" aria-invalid="true" type="STRING">
Thanks for submitting an issue!
By default, I think it's best that Cypress validates that what's being typed into is a valid text input. However, we could make it so that passing {force: true} bypasses the validation, or have a {validate: false} option (that's true by default).
To get around this for now, you could set the value directly instead of using cy.type():
cy.get('input').then(($input) => {
$input.val('text')
});
Or you could change the type of the input to 'text' before typing and change it back after. This is bit more verbose and might not work if your app relies on the type being STRING during the typing.
cy.get('input')
.then(($input) => {
$input[0].type = 'text'
return $input
});
.type('text')
.then(($input) => {
$input[0].type = 'STRING'
});
Thanks !! It solves. Using yours first solution i can write in the input but the "material" type of the input don't recognize like a correct value. But the second option changing the type of the input works. So much thank @chrisbreiding !!
Most helpful comment
Thanks for submitting an issue!
By default, I think it's best that Cypress validates that what's being typed into is a valid text input. However, we could make it so that passing
{force: true}bypasses the validation, or have a{validate: false}option (that's true by default).To get around this for now, you could set the value directly instead of using
cy.type():Or you could change the type of the input to 'text' before typing and change it back after. This is bit more verbose and might not work if your app relies on the type being STRING during the typing.