Full Typescript Cypress project.
I get the following error when trying to use the following custom command in this way:
Usage:
cy.restGetUserId(userEmail).then(userId => {
//do something with userId
});
Custom command:
Cypress.Commands.add('restGetUserId', (userEmail) => {
expect(userEmail).to.not.equal(undefined);
cy.request({
//some request, works!
}).then((response) => {
cy.wrap(response.body.id);
});
});
Currently documented:
/**
* also works as a normal user
*
* @example cy.restGetUserId('some@email.com');
* @param userEmail - get the userId from this email
* @returns the id of the given email/user.
*/
restGetUserId(userEmail: string): string;
My error is most likely in the documentation of this method, what is the recommended way to document this method? (especially the return value i would guess)