Created
March 9, 2020 12:33
-
-
Save kianaditya/ae52425f806be63d81e0431e6bb9252e to your computer and use it in GitHub Desktop.
cypress command overwrite to add delay
This file contains hidden or 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
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