https://cypress.io logo
Guys I hope that you re great I have a
# general-chat
t
Guys, I hope that you're great. I have a couple of questions: 1. I tried to use the getByData custom command in my 'home.cy.ts' file. The 'commands.ts' file has the code: Cypress.Commands.add("getByData", (selector, ...args) => { return cy.get(
[data-test=${selector}]
, ...args) }) and in the tsconfig.json has the code: "compilerOptions": { "types": ["cypress"], But the system gives the massage: Type 'Chainable' is not generic - and - Property 'getByData' does not exist on type 'cy & CyEventEmitter' I've run the command 'npm install --save-dev @types/cypress' but it doesn't work. 2. And the second is that I created a second file in the e2e folder. I've already written the followinginto de file but when I run the command npx cypress open just run the first file but not the second, what should I do? describe("Newsletter Subscribe Form", () => { beforeEach(() => { cy.visit("http://localhost:3000") }) it("allows users to subscribe to the email list", () => { cy.getByData('email-input').type('tom@aol.com') }) }) What's wrong? Thanks in advance.

https://cdn.discordapp.com/attachments/763114122065739818/1090725150267289610/image.png▾

e
For your custom command you may need to add the type to the Cypress interface like below, if you haven't already

https://cdn.discordapp.com/attachments/1090725150204362884/1090741326200455229/image.png▾

I guessed on the definition btw, just an example to get you started
t
Thanks @enough-truck-68085 I'll try to fix it with your recommendations.