Skip to content

Instantly share code, notes, and snippets.

@kianaditya
Created March 9, 2020 12:33
Show Gist options
  • Save kianaditya/ae52425f806be63d81e0431e6bb9252e to your computer and use it in GitHub Desktop.
Save kianaditya/ae52425f806be63d81e0431e6bb9252e to your computer and use it in GitHub Desktop.
cypress command overwrite to add delay
const COMMAND_DELAY = 50;
const COMMAND_LIST =['get', 'visit', 'click', 'trigger', 'type', 'clear', 'reload', 'contains']
for (const command of COMMAND_LIST) {
Cypress.Commands.overwrite(command, (originalFn, ...args) => {
setTimeout(() => {
return originalFn(...args)
}, COMMAND_DELAY);
});
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment