File size: 1,284 Bytes
1e92f2d |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 |
describe('delayError', () => {
it('should delay from errors appear', () => {
cy.visit('http://localhost:3000/delayError');
const firstInput = () => cy.get('input[name="first"]');
const firstInputError = () => cy.get('input[name="first"] + p');
const lastInput = () => cy.get('input[name="last"]');
const lastInputError = () => cy.get('input[name="last"] + p');
firstInput().type('123');
cy.wait(100);
firstInputError().contains('First too long.');
lastInput().type('123567');
cy.wait(100);
lastInputError().contains('Last too long.');
lastInput().blur();
cy.get('button').click();
firstInput().type('123');
lastInput().type('123567');
firstInputError().contains('First too long.');
lastInputError().contains('Last too long.');
firstInput().clear().type('1');
lastInput().clear().type('12');
lastInput().blur();
cy.get('p').should('have.length', 0);
cy.get('button').click();
firstInput().type('aa');
lastInput().type('a');
firstInputError().contains('First too long.');
lastInputError().contains('Last too long.');
firstInput().clear().type('1');
lastInput().clear().type('12');
lastInput().blur();
cy.get('p').should('have.length', 0);
});
});
|