I've setup custom commands for my Cypress tests :
// cypress/support/commands.ts
/// <reference types="cypress"/>
Cypress.Commands.add('getByTestId', (target: [string], timeout: number = 0) => {
target[0] = `[data-testid="${target[0]}"]`;
return cy.get(target.join('>'), { timeout });
});
// cypress/support/index.ts
/// <reference types="cypress" />
declare global {
namespace Cypress {
interface Chainable {
getByTestId(id: string): Chainable<Element>;
}
}
}
these are my files where I setup my commands.
When writing test I have this error even if I had this on the top of my file /// <reference types="cypress" /> :
cypress/integration/filename.test.e2e.ts
