Skip to content

Instantly share code, notes, and snippets.

@alfredlucero
Created July 29, 2020 22:42
Cypress Tips/Tricks - Typing Custom Commands
declare namespace Cypress {
interface Chainable<Subject> {
// Typing out all of our custom commands i.e. cy.login(...)
/**
* Logging in to a user directly through the API
* It returns the auth token in the .then on success
* @example
* cy.login('username', 'password123')
*/
login(username: string, password: string): Chainable<string>;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment