Input: Maximum number of characters #21626
Unanswered
senaoezdogan
asked this question in
Component Testing
Replies: 1 comment 1 reply
-
You can access the // use Cypress._.repeat() to type 40 characters
const moreThanMaxLength = Cypress._.repeat("asdf", 10);
cy.get("#fName").should("be.visible").type(moreThanMaxLength);
cy.get("#fName").should((text) => {
const val = text[0].value;
expect(val.length).to.equal(30);
expect(val).to.not.equal(moreThanMaxLength);
}); Here is the example I used. |
Beta Was this translation helpful? Give feedback.
1 reply
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
I have to test the maximum number of characters for an input. For example, the first name can only have 30 characters. After more than 30 characters, nothing more can be typed. My idea was to enter a first name with 40 characters and to see if the input length is only 30 characters. How can I check the input length, or do you have other ideas, how to check?
Beta Was this translation helpful? Give feedback.
All reactions