Created
October 17, 2019 16:57
-
-
Save andrIvash/7bd79e293c0eaf14f7428c713130cd92 to your computer and use it in GitHub Desktop.
Small gist for cypress to check react input text
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// https://github.com/cypress-io/cypress/issues/566 | |
// https://github.com/cypress-io/cypress/issues/534 | |
// in your commands file: | |
Cypress.Commands.add('fill', { | |
prevSubject: 'element' | |
}, (subject, value) => { | |
cy.wrap(subject).invoke('val', value).trigger('input').trigger('change') | |
}); | |
// Usage in spec: | |
cy.get('[data-my-input-field]').fill('Hello'); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment