Added import 'cypress-file-upload'; to my commands.ts
Get this when I run it:
cy.getByAria(...).attachFile is not a function
(Note that getByAria is a command that I've written. )
I've also tried adding this to index.d.ts:
attachFile(fixture: string, processingOpts: any): Chainable<Element>;
Works
Cypress: 4.5.0
cypress-file-upload: 3.5.3
Does your getByAria return a Chainable
Yes. I use it all the time. It's just
Cypress.Commands.add('getByAria', (label) => cy.get([aria-label="${label}"]));
We use it to force ourselves to add aria labels to everything that a user would need to interface with.
@craig-dae I've fixed this issue by adding cypress-file-upload to my ts config file. E.g.: "types": ["cypress", "cypress-file-upload"]
I think the issue was my version number. Seems to be working now. Thanks for your help!
to others still seeing this issue after following @ajfranzoia's fix, remember to restart your IDE
Most helpful comment
@craig-dae I've fixed this issue by adding
cypress-file-uploadto my ts config file. E.g.:"types": ["cypress", "cypress-file-upload"]