File size: 1,020 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 |
describe('form setFocus', () => {
it('should focus input', () => {
cy.visit('http://localhost:3000/setFocus');
cy.get('button:contains("Focus Input")').click();
cy.get('input[name="focusInput"]').should('be.focused');
});
it('should select input content', () => {
cy.visit('http://localhost:3000/setFocus');
cy.get('button:contains("Select Input Content")').click();
cy.get('input[name="selectInputContent"]')
.type('New Value')
.should('have.value', 'New Value');
});
it('should focus textarea', () => {
cy.visit('http://localhost:3000/setFocus');
cy.get('button:contains("Focus Textarea")').click();
cy.get('textarea[name="focusTextarea"]').should('be.focused');
});
it('should select input content', () => {
cy.visit('http://localhost:3000/setFocus');
cy.get('button:contains("Select Textarea Content")').click();
cy.get('textarea[name="selectTextareaContent"]')
.type('New Value')
.should('have.value', 'New Value');
});
});
|