Embarking on a new project, I added TypeScript and cypress as dependencies to my yarn setup. To kick things off, I crafted an example test with a custom command nestled within it. This particular test can be found in the file
cypress/e2e/cypress/example.cy.ts
, flowing like so:
describe('Example', () => {
it('example', () => {
cy.myCommand();
})
})
The custom command script resides snugly in
cypress/e2e/cypress/support/commands.ts
. Its contents are as follows:
Cypress.Commands.add('myCommand', () => {
cy.visit('https://example.cypress.io')
})
A snag I encountered is when running this setup in Cypress, my test hits a wall with the error message: "cy.myCommand is not a function". How can I fine-tune my tests for optimum performance?
For reference, my Cypress version is 13.6.5.