Skip to content

Instantly share code, notes, and snippets.

@andrIvash
Created October 17, 2019 16:57
Show Gist options
  • Save andrIvash/7bd79e293c0eaf14f7428c713130cd92 to your computer and use it in GitHub Desktop.
Save andrIvash/7bd79e293c0eaf14f7428c713130cd92 to your computer and use it in GitHub Desktop.
Small gist for cypress to check react input text
// 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