Skip to content

Commit

Permalink
Fix Cypress typing
Browse files Browse the repository at this point in the history
  • Loading branch information
felipeelia committed Aug 8, 2024
1 parent b84b6cc commit 54e6aeb
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions tests/cypress/support/commands.js
Original file line number Diff line number Diff line change
Expand Up @@ -84,6 +84,13 @@ Cypress.Commands.add('createTerm', (data) => {
});

Cypress.Commands.add('clearThenType', { prevSubject: true }, (subject, text, force = false) => {
/**
* Typing 'x' and immediately deleting it, as sometimes Cypress is too fast and
* does not type the first character(s) correctly.
*
* @see https://github.com/cypress-io/cypress/issues/3817
*/
cy.wrap(subject).type('x');
cy.wrap(subject).clear();
cy.wrap(subject).type(text, { force });
});
Expand Down

0 comments on commit 54e6aeb

Please sign in to comment.